template<typename T>
class walberla::uid::UID< T >
Class for creating, storing, and managing unique identifiers.
Unique identifiers (UID) can be compared and follow a strict total order (==, !=, >, >=, <, <=). Additionally, every UID is associated with a unique identifier string, meaning that two UIDs that share the same numerical representation (uid_) are also associated with the same identifier string. Furthermore, it is not possible to create two UIDs that have different numerical representations but are both associated with the same identifier string. In other words: two UIDs / UID objects either have the same numerical representation (uid_) and the same identifier string or they have a different numerical representation and a different identifier string.
In addition to being constructed via constructor, UIDs can also be constructed via two static member functions:
getOrConstruct(
const std::string& identifier ) and
get(
const std::string& identifier )
static UID< T > getOrConstruct(const std::string &identifier)
Either returns a copy of an existing UID or creates and returns a completely new UID depending on whe...
Definition UID.h:289
static UID< T > get(const std::string &identifier)
Returns the UID that is associated with the identifier string "identifier".
Definition UID.h:320
For more information on how to create UIDs see the documentation of constructors and these two functions (UIDs can also be copied / copy constructed).
The template T specifies a class that is used to generate the numerical representations (uid_) for all UID<T>s. T must be an implementation of a UID generator class (see "UIDGenerators.h"). Every UID generator implements a static member function "uint_type generatUID()" which returns a new UID every time it is called. Additionally, UID generators implement a static member function "uint_type toIndex( const uint_type uid )" which translates the numerical representations of a given UID into an index which, for example, can be used for array access/storage. Moreover, UID generators implement a static member function "uint_type toBitMask( const uint_type uid )" which translates the numerical UID representations into a bit mask. For further information see the documentation of the two member functions "toIndex()" and "toBitMask()" of this class.
The class UID is thread safe and follows a multiple-readers / single-writer pattern.
|
| UID (const char *const identifier, const bool newUid=false, const bool appendUIDtoIdentifier=false) |
| For documentation see member function 'init'.
|
|
| UID (const std::string &identifier, const bool newUid=false, const bool appendUIDtoIdentifier=false) |
| For documentation see member function 'init'.
|
|
| UID (const bool createAnonymousUID=false) |
| The default constructor (-> createAnonymousUID is false by default!) is used to create uninitialized, invalid UID objects (by just declaring a variable without initializing it at declaration: "UID<T> uid; [...]; uid = [...];").
|
|
uint_type | getUid () const |
|
const std::string & | getIdentifier () const |
|
uint_type | toIndex () const |
| Returns '0' for the first UID created by T::generateUID(), '1' for the second, '2' for the third, etc.
|
|
uint_type | toBitMask () const |
| Returns '[...] 0001' for the first UID created by T::generateUID(), '[...] 0010' for the second, '[...] 0100' for the third, etc.
|
|
void | toStream (std::ostream &os) const |
|
std::string | toString () const |
|
bool | operator== (const UID< T > &uid) const |
|
bool | operator!= (const UID< T > &uid) const |
|
bool | operator> (const UID< T > &uid) const |
|
bool | operator>= (const UID< T > &uid) const |
|
bool | operator< (const UID< T > &uid) const |
|
bool | operator<= (const UID< T > &uid) const |
|