Ocean
Ocean::Thread::ThreadId Class Reference

This class implements a platform independent wrapper for thread ids. More...

Public Member Functions

 ThreadId ()=default
 Creates a new thread id object with invalid id value. More...
 
bool isValid () const
 Returns whether this object holds a valid id. More...
 
uint64_t hash () const
 Returns the hash value of this thread id. More...
 
bool operator== (const ThreadId &id) const
 Returns whether two thread id objects are identical. More...
 
bool operator!= (const ThreadId &id) const
 Returns whether two thread id objects are not identical. More...
 
bool operator< (const ThreadId &id) const
 Compares two thread id objects by their hash values. More...
 

Protected Member Functions

 ThreadId (const uint64_t value)
 Creates a new thread id object. More...
 

Static Protected Member Functions

static constexpr uint64_t invalidThreadId ()
 Returns an invalid thread id value. More...
 

Protected Attributes

uint64_t value_ = invalidThreadId()
 The value of the thread id. More...
 

Friends

class Thread
 

Detailed Description

This class implements a platform independent wrapper for thread ids.

Constructor & Destructor Documentation

◆ ThreadId() [1/2]

Ocean::Thread::ThreadId::ThreadId ( )
default

Creates a new thread id object with invalid id value.

◆ ThreadId() [2/2]

Ocean::Thread::ThreadId::ThreadId ( const uint64_t  value)
inlineexplicitprotected

Creates a new thread id object.

Parameters
valueThe value to be wrapped by the new object

Member Function Documentation

◆ hash()

uint64_t Ocean::Thread::ThreadId::hash ( ) const
inline

Returns the hash value of this thread id.

On platforms directly providing a unique integer thread id as value the hash value is exactly that integer value.

Returns
The unique hash value of this thread id

◆ invalidThreadId()

constexpr uint64_t Ocean::Thread::ThreadId::invalidThreadId ( )
staticconstexprprotected

Returns an invalid thread id value.

Returns
The invalid thread id value

◆ isValid()

bool Ocean::Thread::ThreadId::isValid ( ) const
inline

Returns whether this object holds a valid id.

Returns
True, if succeeded

◆ operator!=()

bool Ocean::Thread::ThreadId::operator!= ( const ThreadId id) const
inline

Returns whether two thread id objects are not identical.

Parameters
idThe second thread id to compare
Returns
True, if succeeded

◆ operator<()

bool Ocean::Thread::ThreadId::operator< ( const ThreadId id) const
inline

Compares two thread id objects by their hash values.

Parameters
idThe second thread id to compare
Returns
True, if the hash value of this object is smaller than the hash value of the second object

◆ operator==()

bool Ocean::Thread::ThreadId::operator== ( const ThreadId id) const
inline

Returns whether two thread id objects are identical.

Parameters
idThe second thread id to compare
Returns
True, if succeeded

Friends And Related Function Documentation

◆ Thread

friend class Thread
friend

Field Documentation

◆ value_

uint64_t Ocean::Thread::ThreadId::value_ = invalidThreadId()
protected

The value of the thread id.


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