36 this->m_belief = b.m_belief;
46 bSub.addString(
"belief");
47 Bottle& bSubIds = bSub.addList();
48 for(
auto& m_belief_item : m_belief)
50 Bottle& bSub2 = bSubIds.addList();
51 bSub2 = m_belief_item.asBottle();
56 bSubEmotions.addString(
"emotions");
57 Bottle& bSubEmoList = bSubEmotions.addList();
60 Bottle& bSubEmo = bSubEmoList.addList();
61 bSubEmo.addString(m_emotion_intrinsic.first.c_str());
62 bSubEmo.addDouble(m_emotion_intrinsic.second);
64 b.addList() = bSubEmotions;
67 bSubBody.addString(
"body");
69 b.addList() = bSubBody;
79 if (!b.check(
"belief")||!b.check(
"emotions"))
83 Bottle*
beliefs = b.find(
"belief").asList();
84 for(
unsigned int i=0; i<beliefs->size() ; i++)
86 Bottle* bRelation = beliefs->get(i).asList();
88 m_belief.push_back(r);
92 Bottle* emotions = b.find(
"emotions").asList();
93 for(
unsigned int i=0; i<emotions->size() ; i++)
95 Bottle* bEmo = emotions->get(i).asList();
96 string emotionName = bEmo->get(0).asString().c_str();
97 double emotionValue = bEmo->get(1).asDouble();
101 Bottle* bodyProperty = b.find(
"body").asList();
109 std::ostringstream oss;
112 oss<<
"Believes that : \n";
113 for(
const auto& it : m_belief)
115 oss<< it.toString() <<endl;
118 oss<<
"Emotions:"<<endl;
121 oss<<
'\t'<<it.first <<
" : "<<it.second<<endl;
130 list<Relation>::const_iterator it = find(m_belief.begin(),m_belief.end(),r);
131 if (it != m_belief.end())
137 m_belief.push_back(r);
145 list<Relation>::iterator it = find(m_belief.begin(),m_belief.end(),r);
146 if (it != m_belief.end())
158 return (find(m_belief.begin(),m_belief.end(),r) != m_belief.end());
std::map< std::string, double > m_emotions_intrinsic
bool checkBelief(const Relation &r) const
Check if some relation is believed by an agent.
Represent any physical entity (including objects and agents) that can be stored within the OPC...
yarp::sig::VectorOf< double > m_ego_position
Position of the Object, in the initial ego-centered reference frame of the agent mainting the OPC (in...
bool removeBelief(const Relation &r)
Remove the belief of a relation from the agent.
bool addBelief(const Relation &r)
Add the belief of a relation to the agent.
virtual bool fromBottle(const yarp::os::Bottle &b)
Fill entity fields from a bottle representation.
bool fromBottle(const yarp::os::Bottle &b)
yarp::os::Bottle asBottle() const
virtual std::string toString() const
Return a human readable description of the entity.
Represent a relation between two entities.
virtual std::string toString() const
Return a human readable description of the entity.
virtual yarp::os::Bottle asBottle() const
Return the entity as a bottle.
const std::list< Relation > & beliefs() const
Get a read-only copy of the agent believes.
virtual yarp::os::Bottle asBottle() const
Return the entity as a bottle.
std::string m_entity_type
virtual bool fromBottle(const yarp::os::Bottle &b)
Fill entity fields from a bottle representation.