Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
Identifiable Class Reference

#include <Identifiable.hpp>

+ Inheritance diagram for Identifiable:
+ Collaboration diagram for Identifiable:

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 segmentation fault.

Definition at line 53 of file Identifiable.hpp.

Constructor & Destructor Documentation

◆ ~Identifiable()

Identifiable::~Identifiable ( )
virtual

Virtual destructor to make this class polymorphic.

Definition at line 90 of file Identifiable.cpp.

Member Function Documentation

◆ GetIdentifier()

std::string Identifiable::GetIdentifier ( ) const
Returns
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 94 of file Identifiable.cpp.

References TidyTemplatedExportIdentifier().

Referenced by AbstractCellCycleModel::OutputCellCycleModelInfo(), AbstractSrnModel::OutputSrnModelInfo(), and AbstractOneStepIvpOdeSolver::Solve().

◆ TidyTemplatedExportIdentifier()

std::string Identifiable::TidyTemplatedExportIdentifier ( std::string  identifier) const
private
Returns
a name which is suitable for use as an XML element name 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
identifierthe identifier to tidy

Definition at line 47 of file Identifiable.cpp.

Referenced by GetIdentifier().


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