8 #ifndef META_OCEAN_TEST_TESTBASE_TEST_SCOPED_OBJECT_H
9 #define META_OCEAN_TEST_TESTBASE_TEST_SCOPED_OBJECT_H
86 uint64_t uniqueIdCounter_ = 0ull;
110 explicit inline Object(
const uint64_t
id);
116 inline uint64_t id()
const;
141 static bool test(
const double testDuration);
This class implements a recursive lock object.
Definition: Lock.h:31
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
Definition: TestScopedObject.h:34
bool hasObject(const uint64_t id) const
Returns whether the manager hold at least one object associated with a specific id.
void addObject(const uint64_t id)
Adds an object with specific id.
IdCounterMap idCounterMap_
The map mapping ids to counters.
Definition: TestScopedObject.h:89
Manager()=default
Default constructor.
std::unordered_map< uint64_t, uint64_t > IdCounterMap
Definition: TestScopedObject.h:39
bool removeObject(const uint64_t id)
Removes an object with a specific id.
uint64_t uniqueId()
Returns a thread-safe unique id.
uint64_t numberObjects(const uint64_t id) const
Returns the number of objects associated with a specific id.
Lock lock_
The manager's lock.
Definition: TestScopedObject.h:92
This class implements an object.
Definition: TestScopedObject.h:99
Object()=default
Default constructor.
uint64_t id() const
Returns the id of the object.
Definition: TestScopedObject.h:191
This class implement a test for the ScopedObject class.
Definition: TestScopedObject.h:30
std::vector< Object * > ObjectPointers
Definition of a vector holding pointers to objects.
Definition: TestScopedObject.h:127
static Object * createObject(const uint64_t id)
Creates a new object.
static bool testCompileTime(const double testDuration)
Tests the ScopedObject with compile time release function.
static void releaseObject(Object *object)
Releases an object.
static bool test(const double testDuration)
Tests the ScopedObject class.
static CounterMap & counterMap()
Returns a static map mapping ids to counters.
static bool increaseCounter(const uint32_t id)
Increases the counter of the counter map.
static bool testRuntime(const double testDuration)
Tests the ScopedObject with runtime release function.
std::unordered_map< int32_t, size_t > CounterMap
Definition of an unordered map mapping ids to counters.
Definition: TestScopedObject.h:132
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15