RAVENNAKIT
Loading...
Searching...
No Matches
rav::Id Class Reference

A class which represents a unique identifier. More...

#include <id.hpp>

Classes

class  Generator

Public Member Functions

 Id ()=default
 Id (const uint64_t int_id)
 Constructs an id from an integer value.
 Id (const Id &other)=default
Id & operator= (const Id &other)=default
 Id (Id &&other) noexcept=default
Id & operator= (Id &&other) noexcept=default
bool is_valid () const noexcept
uint64_t value () const
std::string to_string () const
bool operator== (const uint64_t value) const

Static Public Member Functions

static Id get_next_process_wide_unique_id () noexcept
 Returns the next id from a process-wide, global generator.

Friends

bool operator== (const Id &lhs, const Id &rhs)
bool operator!= (const Id &lhs, const Id &rhs)

Detailed Description

A class which represents a unique identifier.

How unique the identifier is depends on how this class is used. The id itself is a uint64_t.

Definition at line 38 of file id.hpp.

Constructor & Destructor Documentation

◆ Id() [1/4]

rav::Id::Id ( )
default

◆ Id() [2/4]

rav::Id::Id ( const uint64_t int_id)
inlineexplicit

Constructs an id from an integer value.

Parameters
int_idThe integer value of the ID

Definition at line 79 of file id.hpp.

◆ Id() [3/4]

rav::Id::Id ( const Id & other)
default

◆ Id() [4/4]

rav::Id::Id ( Id && other)
defaultnoexcept

Member Function Documentation

◆ get_next_process_wide_unique_id()

Id rav::Id::get_next_process_wide_unique_id ( )
inlinestaticnoexcept

Returns the next id from a process-wide, global generator.

This function is thread safe and can be safely called from any thread at any time.

Returns
The next id.

Definition at line 125 of file id.hpp.

◆ is_valid()

bool rav::Id::is_valid ( ) const
inlinenodiscardnoexcept
Returns
True if the id is not 0, false otherwise.

Definition at line 90 of file id.hpp.

◆ operator=() [1/2]

Id & rav::Id::operator= ( const Id & other)
default

◆ operator=() [2/2]

Id & rav::Id::operator= ( Id && other)
defaultnoexcept

◆ operator==()

bool rav::Id::operator== ( const uint64_t value) const
inline

Definition at line 108 of file id.hpp.

◆ to_string()

std::string rav::Id::to_string ( ) const
inlinenodiscard
Returns
The integer value of the ID as string.

Definition at line 104 of file id.hpp.

◆ value()

uint64_t rav::Id::value ( ) const
inlinenodiscard
Returns
The integer value of the ID.

Definition at line 97 of file id.hpp.

◆ operator!=

bool operator!= ( const Id & lhs,
const Id & rhs )
friend

Definition at line 116 of file id.hpp.

◆ operator==

bool operator== ( const Id & lhs,
const Id & rhs )
friend

Definition at line 112 of file id.hpp.


The documentation for this class was generated from the following file: