ObjectStorage.cpp
Go to the documentation of this file.
2 
5 #include "wire/core/Evidence.h"
6 
7 using namespace std;
8 
9 namespace mhf {
10 
11 ObjectStorage* ObjectStorage::instance_ = 0;
12 
13 ObjectStorage& ObjectStorage::getInstance() {
14  if (instance_) {
15  return *instance_;
16  }
17  instance_ = new ObjectStorage();
18  return *instance_;
19 }
20 
21 ObjectStorage::ObjectStorage() : ID_(0), knowledge_db_(KnowledgeDatabase::getInstance()) {
22 
23 }
24 
26 
27 }
28 
30  objects_.push_back(obj);
31  obj->it_obj_storage_ = --objects_.end();
32 }
33 
35  objects_.erase(obj.it_obj_storage_);
36 }
37 
39  return ID_++;
40 }
41 
42 void ObjectStorage::match(const Evidence& ev) {
43 
44  //cout << endl << "ObjectStorage::match" << endl;
45 
46  for(list<SemanticObject*>::iterator it_obj = objects_.begin(); it_obj != objects_.end(); ++it_obj) {
47  SemanticObject& obj = **it_obj;
48  obj.propagate(ev.getTimestamp());
49  }
50 
51  for(list<SemanticObject*>::iterator it_obj = objects_.begin(); it_obj != objects_.end(); ++it_obj) {
52  SemanticObject& obj = **it_obj;
53 
54  double prob_existing = KnowledgeDatabase::getInstance().getProbabilityExisting(ev, obj);
55  if (prob_existing > 0) {
56 
57  //cout << "Adding evidence " << &ev << " to object " << &obj << endl;
58 
59  obj.addPotentialAssignment(ev, prob_existing);
60  }
61  }
62 }
63 
64 }
Time getTimestamp() const
std::list< SemanticObject * > objects_
Definition: ObjectStorage.h:37
void addObject(SemanticObject *obj)
static KnowledgeDatabase & getInstance()
iterator(field< oT > &in_M, const bool at_end=false)
std::list< SemanticObject * >::iterator it_obj_storage_
The class Evidence represents a set of properties (PropertySet) that all originate from one physical ...
Definition: Evidence.h:61
double getProbabilityExisting(const Evidence &z, const SemanticObject &obj)
void match(const Evidence &ev)
virtual ~ObjectStorage()
void propagate(const Time &time)
Propagates the internal state to Time time.
Definition: PropertySet.cpp:95
void addPotentialAssignment(const Evidence &ev, double probability)
void removeObject(SemanticObject &obj)
Definition: ClassModel.h:44


wire_core
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:27