-
Notifications
You must be signed in to change notification settings - Fork 1
/
EmotionVector.cpp
115 lines (89 loc) · 2.87 KB
/
EmotionVector.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "EmotionVector.h"
empathy::EmotionVector::EmotionVector():
happiness(0),
sadness(0),
anger(0),
surprise(0),
neutral(0),
contempt(0),
disgust(0),
fear(0)
{
}
empathy::EmotionVector::EmotionVector(cJSON *vector)
{
happiness = (float) cJSON_GetObjectItem(vector, "happiness")->valuedouble;
sadness = (float) cJSON_GetObjectItem(vector, "sadness")->valuedouble;
disgust = (float) cJSON_GetObjectItem(vector, "disgust")->valuedouble;
contempt = (float) cJSON_GetObjectItem(vector, "contempt")->valuedouble;
anger = (float) cJSON_GetObjectItem(vector, "anger")->valuedouble;
neutral = (float) cJSON_GetObjectItem(vector, "neutral")->valuedouble;
fear = (float) cJSON_GetObjectItem(vector, "fear")->valuedouble;
surprise = (float) cJSON_GetObjectItem(vector, "surprise")->valuedouble;
}
float empathy::EmotionVector::getHappiness() const {
return happiness;
}
void empathy::EmotionVector::setHappiness(float happiness) {
empathy::EmotionVector::happiness = happiness;
}
float empathy::EmotionVector::getSadness() const {
return sadness;
}
void empathy::EmotionVector::setSadness(float sadness) {
empathy::EmotionVector::sadness = sadness;
}
float empathy::EmotionVector::getContempt() const {
return contempt;
}
void empathy::EmotionVector::setContempt(float contempt) {
empathy::EmotionVector::contempt = contempt;
}
float empathy::EmotionVector::getDisgust() const {
return disgust;
}
void empathy::EmotionVector::setDisgust(float disgust) {
empathy::EmotionVector::disgust = disgust;
}
float empathy::EmotionVector::getFear() const {
return fear;
}
void empathy::EmotionVector::setFear(float fear) {
empathy::EmotionVector::fear = fear;
}
float empathy::EmotionVector::getNeutral() const {
return neutral;
}
void empathy::EmotionVector::setNeutral(float neutral) {
empathy::EmotionVector::neutral = neutral;
}
float empathy::EmotionVector::getSurprise() const {
return surprise;
}
void empathy::EmotionVector::setSurprise(float surprise) {
empathy::EmotionVector::surprise = surprise;
}
float empathy::EmotionVector::getAnger() const {
return anger;
}
void empathy::EmotionVector::setAnger(float anger) {
empathy::EmotionVector::anger = anger;
}
namespace empathy{
EmotionVector* EmotionVector::resultVector = new EmotionVector();
void EmotionVector::processVector(EmotionVector &vector) {
resultVector->disgust = vector.disgust;
resultVector->anger = vector.anger;
resultVector->happiness = vector.happiness;
resultVector->surprise = vector.surprise;
resultVector->neutral = vector.neutral;
resultVector->fear = vector.contempt;
resultVector->contempt = vector.contempt;
}
std::string EmotionVector::getDominantEmotion(){
return "sad";
}
bool EmotionVector::isHappy(){
return getDominantEmotion() == "happy";
}
}