Chaste  Build::
ParameterCollection Class Reference

#include <ParameterCollection.hpp>

+ Inheritance diagram for ParameterCollection:
+ Collaboration diagram for ParameterCollection:

Public Member Functions

void AddParameter (boost::shared_ptr< BaseParameterInstance > pParameter, const std::string &rFirstInstantiated)
 
void DumpToFile (const std::string &rFilename)
 
boost::shared_ptr< BaseParameterInstanceGetParameter (const std::string &rName)
 

Static Public Member Functions

static ParameterCollectionInstance ()
 
static boost::shared_ptr< ParameterCollectionSharedInstance ()
 
static void Destroy ()
 

Protected Member Functions

 ParameterCollection ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 

Private Attributes

std::map< std::string, std::pair< std::string, boost::shared_ptr< BaseParameterInstance > > > mParameters
 

Static Private Attributes

static boost::shared_ptr< ParameterCollectionmpInstance = boost::shared_ptr<ParameterCollection>()
 

Friends

class boost::serialization::access
 

Detailed Description

This singleton holds parameter values used in a simulation. It allows the value of parameters used in a simulation to be dumped to file on completion. New parameters can be added at run-time, which can hold meta-data on parameter sources.

Definition at line 54 of file ParameterCollection.hpp.

Constructor & Destructor Documentation

ParameterCollection::ParameterCollection ( )
protected

Default constructor

Sets up an initial parameter collection on construction

Definition at line 66 of file ParameterCollection.cpp.

References mpInstance.

Referenced by Instance(), and SharedInstance().

Member Function Documentation

void ParameterCollection::AddParameter ( boost::shared_ptr< BaseParameterInstance pParameter,
const std::string &  rFirstInstantiated 
)

Add a parameter

Parameters
pParameterthe parameter to add, note it is a base class pointer
rFirstInstantiatedthe class where it is first instantiated

Definition at line 101 of file ParameterCollection.cpp.

References mParameters.

Referenced by BaseParameterInstance::RegisterWithCollection().

void ParameterCollection::Destroy ( )
static

Destroy the current ParameterCollection instance.

Definition at line 115 of file ParameterCollection.cpp.

References mpInstance.

Referenced by Instance(), and SharedInstance().

void ParameterCollection::DumpToFile ( const std::string &  rFilename)

Dump the parameters to file

Parameters
rFilenamethe file to dump to

Definition at line 74 of file ParameterCollection.cpp.

References mParameters.

boost::shared_ptr< BaseParameterInstance > ParameterCollection::GetParameter ( const std::string &  rName)

Return a parameter, note it is returned as a base class pointer. It may need to be cast to an expected class type.

Parameters
rNamethe name of the parameter to return.
Returns
the parameter instance, as a base class pointer

Definition at line 96 of file ParameterCollection.cpp.

References mParameters.

ParameterCollection * ParameterCollection::Instance ( )
static
Returns
a pointer to the singleton instance. This method is needed for serialization. A SharedInstance should be used otherwise. The first time this is called the simulation object is created.

Definition at line 46 of file ParameterCollection.cpp.

References Destroy(), mpInstance, and ParameterCollection().

Referenced by BaseParameterInstance::RegisterWithCollection().

template<class Archive >
void ParameterCollection::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

Serialization of a ParameterCollection object must be done with care. Do not serialize this singleton directly. Instead, serialize the object returned by GetSerializationWrapper.

Parameters
archivethe archive
versionthe current version of this class

Definition at line 130 of file ParameterCollection.hpp.

References mParameters.

boost::shared_ptr< ParameterCollection > ParameterCollection::SharedInstance ( )
static
Returns
a pointer to the singleton instance The first time this is called the simulation object is created.

Definition at line 56 of file ParameterCollection.cpp.

References Destroy(), mpInstance, and ParameterCollection().

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 119 of file ParameterCollection.hpp.

Member Data Documentation

std::map<std::string, std::pair<std::string, boost::shared_ptr<BaseParameterInstance> > > ParameterCollection::mParameters
private

Parameter Collection

Definition at line 64 of file ParameterCollection.hpp.

Referenced by AddParameter(), DumpToFile(), GetParameter(), and serialize().

boost::shared_ptr< ParameterCollection > ParameterCollection::mpInstance = boost::shared_ptr<ParameterCollection>()
staticprivate

A pointer to the singleton instance of this class.

Pointer to the single instance

Definition at line 59 of file ParameterCollection.hpp.

Referenced by Destroy(), Instance(), ParameterCollection(), and SharedInstance().


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