MCPcopy Create free account
hub / github.com/OAID/Tengine / SafeReplace

Method SafeReplace

core/include/safe_object_manager.hpp:89–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 static bool SafeReplace(const std::string& name, const T& data)
90 {
91 auto manager = SimpleObjectManager<M, T>::GetInstance();
92
93 manager->Lock();
94
95 if(manager->count(name) == 0)
96 {
97 manager->Unlock();
98
99 return false;
100 }
101
102 T& old_data = (*manager)[name];
103 FreeObject(old_data);
104
105 (*manager)[name] = data;
106
107 manager->Unlock();
108
109 return true;
110 }
111
112 static bool SafeRemove(const std::string& name)
113 {

Callers

nothing calls this directly

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected