38 template <
class ObjectTypePtr,
class Id = std::
string>
78 auto it = map.find(
id);
85 throw LocalException(
"key not found!");
94 auto it = map.find(
id);
97 throw LocalException(
"key exists already");
99 map.insert(std::make_pair(
id, obj));
106 static std::atomic<int> InstanceCounter = {0};
107 return InstanceCounter;
117 std::map<Id, ObjectTypePtr>&
120 static std::map<Id, ObjectTypePtr> map;
std::map< Id, ObjectTypePtr > & getCache() const
bool hasObject(const Id &id) const
ScopedLockPtr getMapLock() const
void insertObject(const Id &id, const ObjectTypePtr &obj)
GlobalCache(const GlobalCache &source)
std::atomic< int > & getInstanceCounter()
ObjectTypePtr getCacheObject(const Id &id)
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
std::shared_ptr< ScopedLock > ScopedLockPtr
Mutex::scoped_lock ScopedLock
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::string GetTypeString(const std::type_info &tinf, bool withoutNamespaceSpecifier=false)