Sundance::ObjectWithInstanceID< T > Class Template Reference

List of all members.

Public Member Functions

 ObjectWithInstanceID ()
int id () const

Static Private Member Functions

static int & nextID ()

Private Attributes

int id_

Detailed Description

template<class T>
class Sundance::ObjectWithInstanceID< T >

ObjectWithInstanceID provides a common method for the generation of instance-specific ID numbers. Subclasses will inherit the id() method, and instances of those subclasses will be given a unique ID at construction time.

Design note:

By templating on the derived type, we can give each derived type its own sequence of ID numbers.

Definition at line 51 of file SundanceObjectWithInstanceID.hpp.

Constructor & Destructor Documentation

template<class T>
Sundance::ObjectWithInstanceID< T >::ObjectWithInstanceID (  )  [inline]

Empty ctor will assign ID at construction time

Definition at line 55 of file SundanceObjectWithInstanceID.hpp.

Member Function Documentation

template<class T>
int Sundance::ObjectWithInstanceID< T >::id (  )  const [inline]

Return this object's ID number

Definition at line 58 of file SundanceObjectWithInstanceID.hpp.

template<class T>
static int& Sundance::ObjectWithInstanceID< T >::nextID (  )  [inline, static, private]

Generate the next ID in the sequence

Definition at line 62 of file SundanceObjectWithInstanceID.hpp.

Member Data Documentation

template<class T>
int Sundance::ObjectWithInstanceID< T >::id_ [private]

Site Contact