8#ifndef META_OCEAN_TEST_TESTBASE_TEST_SCOPED_OBJECT_H
9#define META_OCEAN_TEST_TESTBASE_TEST_SCOPED_OBJECT_H
87 uint64_t uniqueIdCounter_ = 0ull;
111 explicit inline Object(
const uint64_t
id);
117 inline uint64_t id()
const;
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:35
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:90
Manager()=default
Default constructor.
std::unordered_map< uint64_t, uint64_t > IdCounterMap
Definition TestScopedObject.h:40
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:93
This class implements an object.
Definition TestScopedObject.h:100
Object()=default
Default constructor.
uint64_t id() const
Returns the id of the object.
Definition TestScopedObject.h:193
This class implement a test for the ScopedObject class.
Definition TestScopedObject.h:31
static bool testCompileTime(const double testDuration)
Tests the ScopedObject with compile time release function.
static void releaseObject(Object *object)
Releases an object.
std::vector< Object * > ObjectPointers
Definition of a vector holding pointers to objects.
Definition TestScopedObject.h:128
static bool test(const double testDuration, const TestSelector &selector=TestSelector())
Tests the ScopedObject class.
static Object * createObject(const uint64_t id)
Creates a new object.
std::unordered_map< int32_t, size_t > CounterMap
Definition of an unordered map mapping ids to counters.
Definition TestScopedObject.h:133
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.
static CounterMap & counterMap()
Returns a static map mapping ids to counters.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
The namespace covering the entire Ocean framework.
Definition Accessor.h:15