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

Method SafeAdd

core/include/safe_object_manager.hpp:70–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 static bool SafeAdd(const std::string& name, const T& data)
71 {
72 auto manager = SimpleObjectManager<M, T>::GetInstance();
73
74 manager->Lock();
75
76 if(manager->count(name))
77 {
78 manager->Unlock();
79 return false;
80 }
81
82 (*manager)[name] = data;
83
84 manager->Unlock();
85
86 return true;
87 }
88
89 static bool SafeReplace(const std::string& name, const T& data)
90 {

Callers

nothing calls this directly

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected