Identifiable Class Reference

#include <Identifiable.hpp>

Inheritance diagram for Identifiable:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~Identifiable ()
std::string GetIdentifier () const

Private Member Functions

std::string TidyTemplatedExportIdentifier (std::string identifier) const


Detailed Description

"Mix-in" base class for any class that needs to provide a unique ID specifying what type the derived class is.

All you need to do to use this is inherit from this class at the base of your hierarchy, and provide a Boost Serialization export key for every concrete class. Also, any test in which the GetIdentifier method is used, even via the main cell_based code, must include CheckpointArchiveTypes.hpp or CellBasedSimulationArchiver.hpp as the first Chaste header included. Failure to do so will result in a seg fault.

Definition at line 46 of file Identifiable.hpp.


Constructor & Destructor Documentation

Identifiable::~Identifiable (  )  [virtual]

Virtual destructor to make this class polymorphic.

Definition at line 86 of file Identifiable.cpp.


Member Function Documentation

std::string Identifiable::GetIdentifier (  )  const

Return the unique identifier of the concrete class.

This method uses Boost's serialization's extended_type_info and returns the identifier of the derived class (this is defined when the macro CHASTE_CLASS_EXPORT is invoked in each derived class, and is usually just the name of the class).

Note that you must include the header CheckpointArchiveTypes.hpp in any test suite that calls this method.

Definition at line 90 of file Identifiable.cpp.

References TidyTemplatedExportIdentifier().

Referenced by AbstractCellKiller< DIM >::OutputCellKillerInfo(), AbstractCellPopulation< DIM >::OutputCellPopulationInfo(), AbstractForce< DIM >::OutputForceInfo(), and CellBasedSimulation< DIM >::OutputSimulationSetup().

std::string Identifiable::TidyTemplatedExportIdentifier ( std::string  identifier  )  const [private]

Templated classes get Boost Serialization export keys that look like "pack<void (NameOfDerivedType< DIM >)>::type". This method converts it to a nice name suitable for use as an XML element name, i.e. of the form "NameOfDerivedType-DIM". Works for classes templated over any number of parameters, providing the values are allowable in XML element names.

Parameters:
identifier the identifier to tidy

#1453 There are currently no identifiables with multiple template parameters...

Todo:
#1453 - implement the following if needed if (i != identifier.npos) { identifier.replace(i, s_comma.length(), s_dash); }

Definition at line 40 of file Identifiable.cpp.

Referenced by GetIdentifier().


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

Generated on Mon Nov 1 12:36:51 2010 for Chaste by  doxygen 1.5.5