8 #ifndef OBSERVERTABLE_HPP_ 9 #define OBSERVERTABLE_HPP_ 11 #include "observerpattern/Observer.hpp" 32 std::vector<Observer *>
const &getObjectVector()
const {
return mObjectVector; }
33 std::map<std::string, Observer *>
const &getObjectMap()
const {
return mObjectMap; }
34 Observer *getObject(std::string
const &name)
const {
35 auto lookupResult = mObjectMap.find(name);
36 return lookupResult == mObjectMap.end() ?
nullptr : lookupResult->second;
38 Observer *getObject(
char *name)
const {
return getObject(std::string(name)); };
39 std::vector<Observer *>::size_type size()
const;
40 bool addObject(std::string
const &name,
Observer *entry);
41 void deleteObject(std::string
const &name,
bool deallocateFlag);
42 void deleteObject(
char const *name,
bool deallocateFlag) {
43 deleteObject(std::string(name), deallocateFlag);
45 void clear(
bool deallocateFlag);
48 S *lookup(std::string
const &name)
const {
49 return lookup<S>(name.c_str());
53 S *lookup(
char const *name)
const {
54 S *lookupResult =
nullptr;
55 auto findResult = mObjectMap.find(name);
56 if (findResult != mObjectMap.end()) {
57 auto observerPtr = findResult->second;
58 lookupResult =
dynamic_cast<S *
>(observerPtr);
64 std::vector<Observer *> mObjectVector;
65 std::map<std::string, Observer *> mObjectMap;