InstanceId< Class, ValueType > Class Template Reference

#include <InstanceId.h>

Inheritance diagram for InstanceId< Class, ValueType >:
Collaboration diagram for InstanceId< Class, ValueType >:

Public Types

typedef ValueType Value
 id storage type More...
 

Public Member Functions

 InstanceId ()
 
 operator Value () const
 
bool operator== (const InstanceId &o) const
 
bool operator!= (const InstanceId &o) const
 
void change ()
 
std::ostream & print (std::ostream &) const
 writes a compact text representation of the ID More...
 
const char * prefix () const
 
ScopedId detach () const
 

Public Attributes

Value value = Value()
 instance identifier More...
 

Private Member Functions

 InstanceId (const InstanceId &)
 not implemented; IDs are unique More...
 
InstanceIdoperator= (const InstanceId &)
 not implemented More...
 

Detailed Description

template<class Class, class ValueType = InstanceIdDefaultValueType>
class InstanceId< Class, ValueType >

Identifier for class instances

  • unique IDs for a large number of concurrent instances, but may wrap;
  • useful for debugging and insecure request/response matching;
  • sequential IDs within a class except when wrapping;
  • always positive IDs. TODO: add creation/destruction debugging?

Definition at line 46 of file InstanceId.h.

Member Typedef Documentation

◆ Value

template<class Class , class ValueType = InstanceIdDefaultValueType>
typedef ValueType InstanceId< Class, ValueType >::Value

Definition at line 49 of file InstanceId.h.

Constructor & Destructor Documentation

◆ InstanceId() [1/2]

template<class Class , class ValueType = InstanceIdDefaultValueType>
InstanceId< Class, ValueType >::InstanceId ( )
inline

Definition at line 51 of file InstanceId.h.

References InstanceId< Class, ValueType >::change().

◆ InstanceId() [2/2]

template<class Class , class ValueType = InstanceIdDefaultValueType>
InstanceId< Class, ValueType >::InstanceId ( const InstanceId< Class, ValueType > &  )
private

Member Function Documentation

◆ change()

template<class Class , class ValueType = InstanceIdDefaultValueType>
void InstanceId< Class, ValueType >::change ( )

◆ detach()

template<class Class , class ValueType = InstanceIdDefaultValueType>
ScopedId InstanceId< Class, ValueType >::detach ( ) const
inline
Returns
a copy of the ID usable outside our Class context

Definition at line 66 of file InstanceId.h.

References InstanceId< Class, ValueType >::prefix(), and InstanceId< Class, ValueType >::value.

◆ operator Value()

template<class Class , class ValueType = InstanceIdDefaultValueType>
InstanceId< Class, ValueType >::operator Value ( ) const
inline

Definition at line 53 of file InstanceId.h.

References InstanceId< Class, ValueType >::value.

◆ operator!=()

template<class Class , class ValueType = InstanceIdDefaultValueType>
bool InstanceId< Class, ValueType >::operator!= ( const InstanceId< Class, ValueType > &  o) const
inline

Definition at line 55 of file InstanceId.h.

◆ operator=()

template<class Class , class ValueType = InstanceIdDefaultValueType>
InstanceId & InstanceId< Class, ValueType >::operator= ( const InstanceId< Class, ValueType > &  )
private

◆ operator==()

template<class Class , class ValueType = InstanceIdDefaultValueType>
bool InstanceId< Class, ValueType >::operator== ( const InstanceId< Class, ValueType > &  o) const
inline

Definition at line 54 of file InstanceId.h.

References InstanceId< Class, ValueType >::value.

◆ prefix()

template<class Class , class ValueType = InstanceIdDefaultValueType>
const char * InstanceId< Class, ValueType >::prefix ( ) const
Returns
Class-specific nickname (with endless lifetime)

Referenced by InstanceId< Class, ValueType >::detach().

◆ print()

template<class Class , class ValueType = InstanceIdDefaultValueType>
std::ostream & InstanceId< Class, ValueType >::print ( std::ostream &  ) const

Member Data Documentation

◆ value

template<class Class , class ValueType = InstanceIdDefaultValueType>
Value InstanceId< Class, ValueType >::value = Value()

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors