Helper class to enable keeping track of instances of class Object
making use of the owner of the respective ObjectUserList's instance. Instances of class Object
can register or deregister multiple times as an user which increments or decrements their respective registration count in ObjectUserList::UserList.
More...
|
std::unordered_map< const Object *, size_t > | UserList |
| Map containing pointers to all users making use of this ObjectUserList instance's owner as keys and the amount of their active registrations as values. More...
|
|
Helper class to enable keeping track of instances of class Object
making use of the owner of the respective ObjectUserList's instance. Instances of class Object
can register or deregister multiple times as an user which increments or decrements their respective registration count in ObjectUserList::UserList.
Definition at line 79 of file Object.h.
◆ ObjectUserList()
DynExp::ObjectUserList::ObjectUserList |
( |
| ) |
|
|
default |
◆ ~ObjectUserList()
virtual DynExp::ObjectUserList::~ObjectUserList |
( |
| ) |
|
|
virtualdefault |
◆ AcquireLock()
Locks the user list for thread-safe manipulation.
- Parameters
-
Timeout | Timeout of the mutex-locking operation. |
- Returns
- Lock-guard of the underlying mutex. Only use temporarily. Do not store longer than necessary.
Definition at line 9 of file Object.cpp.
◆ CountUsers()
size_t DynExp::ObjectUserList::CountUsers |
( |
std::chrono::milliseconds |
Timeout = std::chrono::milliseconds(0) | ) |
const |
Counts the registered useres in a thread-safe way.
- Parameters
-
Timeout | Timeout of the mutex-locking operation. |
- Returns
- Number of registered users.
Definition at line 35 of file Object.cpp.
◆ CountUsersUnsafe()
size_t DynExp::ObjectUserList::CountUsersUnsafe |
( |
| ) |
const |
◆ Deregister()
void DynExp::ObjectUserList::Deregister |
( |
const Object & |
User, |
|
|
const std::chrono::milliseconds |
Timeout = std::chrono::milliseconds(0) |
|
) |
| |
Deregisters a user in a thread-safe way.
- Parameters
-
User | Instance of class Object to be deregistered as a user. |
Timeout | Timeout of the mutex-locking operation. |
Definition at line 28 of file Object.cpp.
◆ DeregisterAllUnsafe()
void DynExp::ObjectUserList::DeregisterAllUnsafe |
( |
| ) |
|
Deregisters all users and notifies them that they need to check the states of their used linked objects.
Definition at line 56 of file Object.cpp.
◆ DeregisterUnsafe()
void DynExp::ObjectUserList::DeregisterUnsafe |
( |
const Object & |
User | ) |
|
|
private |
Deregisters a user.
- Parameters
-
User | Instance of class Object to be deregistered as a user. |
- Exceptions
-
Util::UnderflowException | is thrown if UserList contains an entry for User with a registration count of zero. This should never happen. |
Definition at line 101 of file Object.cpp.
◆ GetUserIDs()
ItemIDListType DynExp::ObjectUserList::GetUserIDs |
( |
std::chrono::milliseconds |
Timeout = std::chrono::milliseconds(0) | ) |
const |
Returns a list of the IDs of the registered users in a thread-safe way.
- Parameters
-
Timeout | Timeout of the mutex-locking operation. |
- Returns
- List of IDs of registered users.
Definition at line 42 of file Object.cpp.
◆ GetUserIDsUnsafe()
◆ GetUserNamesString()
std::string DynExp::ObjectUserList::GetUserNamesString |
( |
std::chrono::milliseconds |
Timeout = std::chrono::milliseconds(0) | ) |
const |
Builds a string describing which users are registered containing their object names, categories and type names in a thread-safe way.
- Parameters
-
Timeout | Timeout of the mutex-locking operation. |
- Returns
- String containing information about the registered users.
Definition at line 49 of file Object.cpp.
◆ GetUserNamesStringUnsafe()
std::string DynExp::ObjectUserList::GetUserNamesStringUnsafe |
( |
| ) |
const |
◆ Register() [1/2]
void DynExp::ObjectUserList::Register |
( |
const Object & |
User, |
|
|
const std::chrono::milliseconds |
Timeout = std::chrono::milliseconds(0) |
|
) |
| |
Registers a user in a thread-safe way.
- Parameters
-
User | Instance of class Object to be registered as a user. |
Timeout | Timeout of the mutex-locking operation. |
Definition at line 14 of file Object.cpp.
◆ Register() [2/2]
Registers a user making use of a lock-guard previously acquired by a call to AcquireLock().
- Parameters
-
User | Instance of class Object to be registered as a user. |
Lock | Lock-guard of the underlying mutex. Move to this function. |
- Returns
- Lock-guard of the underlying mutex (the same one passed to this function).
Definition at line 21 of file Object.cpp.
◆ RegisterUnsafe()
void DynExp::ObjectUserList::RegisterUnsafe |
( |
const Object & |
User | ) |
|
|
private |
Registers a user.
- Parameters
-
User | Instance of class Object to be registered as a user. |
- Exceptions
-
Util::OverflowException | is thrown if a value in UserList cannot be incremented due to size limitations in UserList's value data type. |
Definition at line 91 of file Object.cpp.
◆ UserList
std::unordered_map<const Object*, size_t> DynExp::ObjectUserList::UserList |
|
private |
Map containing pointers to all users making use of this ObjectUserList instance's owner as keys and the amount of their active registrations as values.
Definition at line 176 of file Object.h.
The documentation for this class was generated from the following files: