17 template <
class K,
class V>
26 bool insert(
const K& _key, V* _object);
31 void replace(
const K& _key, V* _object);
41 V*
const find(
const K& _key);
47 V*
grab(
const K& _key);
56 std::map<K, V *> m_objects;
60template <
class K,
class V>
62 if (m_objects.find(_key) != m_objects.end()) {
return false; }
63 else { m_objects.insert_or_assign(_key, _object);
return true; }
66template <
class K,
class V>
68 if (m_objects.find(_key) != m_objects.end()) {
delete m_objects.find(_key)->second; };
69 m_objects.insert_or_assign(_key, _object);
72template <
class K,
class V>
74 auto it = m_objects.find(_key);
75 if (it == m_objects.end()) {
return (V*)
nullptr; }
76 else {
return it->second; }
79template <
class K,
class V>
81 auto it = m_objects.find(_key);
82 V* ret = (it != m_objects.end() ? it->second : (V*)
nullptr);
83 m_objects.erase(_key);
87template <
class K,
class V>
89 auto it = m_objects.find(_key);
90 if (it == m_objects.end()) {
return (V*)
nullptr; }
91 else {
return it->second; }
CGAL::Exact_predicates_inexact_constructions_kernel K
Definition SelfIntersectionCheck.cpp:21
Definition ObjectManagerTemplate.h:18
bool insert(const K &_key, V *_object)
Store the provided object for the given key. If there exists an entry for the given key the function ...
Definition ObjectManagerTemplate.h:61
bool contains(const K &_key)
Returns true if an entry exits for the given key.
Definition ObjectManagerTemplate.h:35
void replace(const K &_key, V *_object)
Store the provided object for the given key. If there exists an entry for the given key the entry wil...
Definition ObjectManagerTemplate.h:67
V *const operator[](const K &_key)
Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.
Definition ObjectManagerTemplate.h:88
V * grab(const K &_key)
Return stored pointer to object for the given key and remove from object manager. Note that the calle...
Definition ObjectManagerTemplate.h:80
virtual ~ObjectManagerTemplate()
Definition ObjectManagerTemplate.h:20
V *const find(const K &_key)
Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.
Definition ObjectManagerTemplate.h:73