A UniqueId can be added as a class member to enhance any class with a unique identifier for each instantiated object.
Example:
Definition at line 39 of file UniqueId.h.
Public Types | |
| using | Value_t = unsigned long |
Public Member Functions | |
| UniqueId () | |
| Create a new UniqueId with the next value from the static counter. | |
| UniqueId (const UniqueId &)=delete | |
| UniqueId (UniqueId &&)=delete | |
| operator Value_t () const | |
| bool | operator< (UniqueId const &other) const |
| UniqueId & | operator= (const UniqueId &)=delete |
| UniqueId & | operator= (UniqueId &&)=delete |
| bool | operator== (UniqueId const &other) const |
| constexpr Value_t | value () const |
| Return numerical value of ID. | |
Static Public Member Functions | |
| static UniqueId const & | nullid () |
| Get an ID that is less than the ID of any object (similar to nullptr). | |
Static Public Attributes | |
| static constexpr Value_t | nullval = 0UL |
| The value of the nullid. | |
Private Member Functions | |
| UniqueId (Value_t val) | |
Private Attributes | |
| Value_t | _val |
| Numerical value of the ID. | |
Static Private Attributes | |
| static std::atomic< Value_t > | counter {UniqueId<Class>::nullval} |
| The static object counter to get the next ID value. | |
#include <RooFit/UniqueId.h>
| using RooFit::UniqueId< Class >::Value_t = unsigned long |
Definition at line 41 of file UniqueId.h.
|
inline |
Create a new UniqueId with the next value from the static counter.
Definition at line 44 of file UniqueId.h.
|
inlineprivate |
Definition at line 74 of file UniqueId.h.
Get an ID that is less than the ID of any object (similar to nullptr).
Definition at line 65 of file UniqueId.h.
|
inline |
Definition at line 52 of file UniqueId.h.
|
inline |
Definition at line 62 of file UniqueId.h.
|
delete |
|
delete |
|
inline |
Definition at line 61 of file UniqueId.h.
Return numerical value of ID.
Use only if necessary, as the UniqueId type information is lost and copying/moving is not prohibited for the value type. Please don't turn this into a cast operator, as a function with an explicit name is easier to track in the codebase.
Definition at line 59 of file UniqueId.h.
|
private |
Numerical value of the ID.
Definition at line 76 of file UniqueId.h.
|
staticprivate |
The static object counter to get the next ID value.
Definition at line 78 of file UniqueId.h.
The value of the nullid.
Definition at line 71 of file UniqueId.h.