Public Member Functions | Protected Member Functions | Protected Attributes

OpenTissue::utility::Identifier Class Reference

#include <utility_identifier.h>

List of all members.

Public Member Functions

 Identifier ()
virtual ~Identifier ()
 Identifier (Identifier const &id)
Identifieroperator= (Identifier const &id)
bool operator== (Identifier const &id) const
bool operator!= (Identifier const &id) const
void set_id (std::string const &id)
std::string const & get_id () const
size_t get_index () const

Protected Member Functions

void generate_new_index ()

Protected Attributes

std::string m_ID
 An Identifier string.
size_t m_index
 Unique object index.

Detailed Description

Identifier Class. This is an utility class that is supposed to make it easier to create new objects with unique identifiers. The idea is to simply inherit the new object class from the identifier class.

At construction-time the class tries to generate a new unique identifier. Hereafter it is the users responsibility not to mess up the id-name string. However, end-users can always be sure that the index value provided by the identifier class is unique.


Constructor & Destructor Documentation

OpenTissue::utility::Identifier::Identifier (  )  [inline]
virtual OpenTissue::utility::Identifier::~Identifier (  )  [inline, virtual]
OpenTissue::utility::Identifier::Identifier ( Identifier const &  id  )  [inline]

Member Function Documentation

void OpenTissue::utility::Identifier::generate_new_index (  )  [inline, protected]

Static Member Not Initialized in Header Trick (smnih)

This way we avoid having a

static size_t m_next_idx

member variable which must be initialized in a source file.

std::string const& OpenTissue::utility::Identifier::get_id (  )  const [inline]
size_t OpenTissue::utility::Identifier::get_index (  )  const [inline]
bool OpenTissue::utility::Identifier::operator!= ( Identifier const &  id  )  const [inline]
Identifier& OpenTissue::utility::Identifier::operator= ( Identifier const &  id  )  [inline]
bool OpenTissue::utility::Identifier::operator== ( Identifier const &  id  )  const [inline]
void OpenTissue::utility::Identifier::set_id ( std::string const &  id  )  [inline]

Member Data Documentation

An Identifier string.

Unique object index.


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