Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
FamilyMember< TY > Class Template Reference

#include "lib/typed-counter.hpp"

Description

template<typename TY>
class lib::FamilyMember< TY >

Utility to produce member IDs for objects belonging to a "Family", as defined by a distinguishing type.

Within each family, each new instance of FamilyMember holds a new distinct id number.

Remarks
this builds a structure similar to TypedContext, however the second level is not assigned per type but rather per instance of FamilyMember<TY>

Definition at line 203 of file typed-counter.hpp.

Public Member Functions

 FamilyMember ()
 
 operator size_t () const
 
 operator string () const
 

Friends

string operator+ (string const &prefix, FamilyMember id)
 
string operator+ (CStr prefix, FamilyMember id)
 

Static Private Member Functions

static size_t allocateNextMember ()
 threadsafe allocation of member ID
 

Private Attributes

const size_t id_
 

Static Private Attributes

static std::atomic_size_t memberCounter {0}
 member counter shared per template instance
 

Constructor & Destructor Documentation

◆ FamilyMember()

template<typename TY >
FamilyMember ( )
inline

Definition at line 218 of file typed-counter.hpp.

Member Function Documentation

◆ allocateNextMember()

template<typename TY >
static size_t allocateNextMember ( )
inlinestaticprivate

threadsafe allocation of member ID

Definition at line 212 of file typed-counter.hpp.

References FamilyMember< TY >::memberCounter.

◆ operator size_t()

template<typename TY >
operator size_t ( ) const
inline

Definition at line 222 of file typed-counter.hpp.

References FamilyMember< TY >::id_.

◆ operator string()

template<typename TY >
operator string ( ) const
inline

Definition at line 227 of file typed-counter.hpp.

References util::showSize().

+ Here is the call graph for this function:

Member Data Documentation

◆ id_

template<typename TY >
const size_t id_
private

Definition at line 205 of file typed-counter.hpp.

Referenced by FamilyMember< TY >::operator size_t().

◆ memberCounter

template<typename TY >
std::atomic_size_t memberCounter {0}
staticprivate

member counter shared per template instance

allocate storage for the counter per type family

Definition at line 208 of file typed-counter.hpp.

Referenced by FamilyMember< TY >::allocateNextMember().

Friends And Related Symbol Documentation

◆ operator+ [1/2]

template<typename TY >
string operator+ ( string const &  prefix,
FamilyMember< TY >  id 
)
friend

Definition at line 233 of file typed-counter.hpp.

◆ operator+ [2/2]

template<typename TY >
string operator+ ( CStr  prefix,
FamilyMember< TY >  id 
)
friend

Definition at line 239 of file typed-counter.hpp.

+ Collaboration diagram for FamilyMember< TY >:

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