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 Attributes | |
static const UniqueId | nullid {UniqueId<Class>::nullval} |
static constexpr Value_t | nullval = 0UL |
An ID that is less than the ID of any object (similar to nullptr). | |
Private Attributes | |
Value_t | _val |
The value of the nullid. | |
Static Private Attributes | |
static std::atomic< Value_t > | counter {UniqueId<Class>::nullval} |
Numerical value of the ID. | |
#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.
|
delete |
|
delete |
|
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.
|
inlineconstexpr |
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 |
The value of the nullid.
Definition at line 68 of file UniqueId.h.
|
staticprivate |
Numerical value of the ID.
Definition at line 70 of file UniqueId.h.
|
static |
Definition at line 64 of file UniqueId.h.
|
staticconstexpr |
An ID that is less than the ID of any object (similar to nullptr).
Definition at line 65 of file UniqueId.h.