Chaste  Build::
ParameterInstance< UNIT > Class Template Reference

#include <ParameterInstance.hpp>

+ Inheritance diagram for ParameterInstance< UNIT >:
+ Collaboration diagram for ParameterInstance< UNIT >:

Public Member Functions

 ParameterInstance ()
 
 ParameterInstance (units::quantity< UNIT > value, const std::string &rName, const std::string &rShortDescription, const std::string &rSymbol, const std::string &rBibliographicInfromation)
 
virtual ~ParameterInstance ()
 
virtual std::string GetValueAsString ()
 
units::quantity< UNIT > GetValue (const std::string &rCallingClass="User", bool addToCollection=true)
 
void SetValue (units::quantity< UNIT > value)
 
- Public Member Functions inherited from BaseParameterInstance
 BaseParameterInstance ()
 
 BaseParameterInstance (const std::string &rName, const std::string &rShortDescription, const std::string &rSymbol, const std::string &rBibliographicInfromation)
 
virtual ~BaseParameterInstance ()
 
std::string GetName ()
 
std::string GetBibliographicInformation ()
 
std::string GetShortDescription ()
 
std::string GetSymbol ()
 
void RegisterWithCollection (const std::string &rCallingClass)
 
void SetBibliographicInformation (const std::string &rSourceInformation)
 
void SetName (const std::string &rName)
 
void SetShortDescription (const std::string &rShortDescription)
 
void SetSymbol (const std::string &rSymbol)
 

Static Public Member Functions

static boost::shared_ptr< ParameterInstance< UNIT > > Create ()
 
static boost::shared_ptr< ParameterInstance< UNIT > > Create (units::quantity< UNIT > value, const std::string &rName, const std::string &rShortDescription, const std::string &rSymbol, const std::string &rBibliographicInfromation)
 
- Static Public Member Functions inherited from BaseParameterInstance
static boost::shared_ptr< BaseParameterInstanceCreate ()
 

Private Member Functions

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

Private Attributes

units::quantity< UNIT > mValue
 

Friends

class boost::serialization::access
 

Detailed Description

template<class UNIT>
class ParameterInstance< UNIT >

This is a concrete class for storing parameters. It inherits from BaseParameterInstance to allow a heterogenous collection of parameters to be stored in the ParameterCollection. When GetValue is called a class instance will be added to the ParameterCollection singleton. It should also be supplied with a descriptive name for where it is being called from, e.g. by "User" or with a class name.

Definition at line 53 of file ParameterInstance.hpp.

Constructor & Destructor Documentation

template<class UNIT >
ParameterInstance< UNIT >::ParameterInstance ( )

Constructor

Definition at line 39 of file ParameterInstance.cpp.

template<class UNIT >
ParameterInstance< UNIT >::ParameterInstance ( units::quantity< UNIT >  value,
const std::string &  rName,
const std::string &  rShortDescription,
const std::string &  rSymbol,
const std::string &  rBibliographicInfromation 
)

Constructor with some present values

Parameters
valuethe quantity form the parameter
rNamethe named by which it will be keyed in the ParameterCollection
rShortDescriptiona short description of the parameter
rSymbola symbol, as it may appear in the literature
rBibliographicInfromationa Bibtex formatted literature source.

Definition at line 47 of file ParameterInstance.cpp.

template<class UNIT >
ParameterInstance< UNIT >::~ParameterInstance ( )
virtual

Destructor

Definition at line 59 of file ParameterInstance.cpp.

Member Function Documentation

template<class UNIT >
boost::shared_ptr< ParameterInstance< UNIT > > ParameterInstance< UNIT >::Create ( )
static

Factory constructor method

Returns
a shared pointer to a new instance

Definition at line 65 of file ParameterInstance.cpp.

template<class UNIT >
boost::shared_ptr< ParameterInstance< UNIT > > ParameterInstance< UNIT >::Create ( units::quantity< UNIT >  value,
const std::string &  rName,
const std::string &  rShortDescription,
const std::string &  rSymbol,
const std::string &  rBibliographicInfromation 
)
static

Factory constructor method

Parameters
valuethe quantity form the parameter
rNamethe named by which it will be keyed in the ParameterCollection
rShortDescriptiona short description of the parameter
rSymbola symbol, as it may appear in the literature
rBibliographicInfromationa Bibtex formatted literature source.
Returns
a shared pointer to a new instance

Definition at line 72 of file ParameterInstance.cpp.

template<class UNIT >
units::quantity< UNIT > ParameterInstance< UNIT >::GetValue ( const std::string &  rCallingClass = "User",
bool  addToCollection = true 
)

Get the value of the parameter. IMPORTANT. This call is expensive as the instance will try to add itself automatically to the ParameterCollection by default. This requires a map lookup and insert. This should be called once per 'scope' to get the value of the parameter into a temporary.

Parameters
rCallingClassthe name of the class calling this method, or "User" if it is being called directly in a test or main().
addToCollectionwhether to add self to the parameter collection.
Returns
the value of the parameter

Definition at line 83 of file ParameterInstance.cpp.

References ParameterInstance< UNIT >::mValue, and BaseParameterInstance::RegisterWithCollection().

template<class UNIT >
std::string ParameterInstance< UNIT >::GetValueAsString ( )
virtual

Over-ridden method to get the value of the parameter as a "Value Unit" string (e.g. "2.0 kg"). It is used in the ParameterCollection which only stores BaseParameterInstance pointers.

Returns
the values as a string.

Reimplemented from BaseParameterInstance.

Definition at line 95 of file ParameterInstance.cpp.

References ParameterInstance< UNIT >::mValue.

template<class UNIT >
template<class Archive >
void ParameterInstance< UNIT >::serialize ( Archive &  ar,
const unsigned int  version 
)
inlineprivate

Do the serialize

Parameters
arthe archive
versionthe archive version number

Definition at line 66 of file ParameterInstance.hpp.

References ParameterInstance< UNIT >::mValue.

template<class UNIT >
void ParameterInstance< UNIT >::SetValue ( units::quantity< UNIT >  value)

Set the value of the parameter

Parameters
valuethe value of the parameter

Definition at line 103 of file ParameterInstance.cpp.

References ParameterInstance< UNIT >::mValue.

Friends And Related Function Documentation

template<class UNIT >
friend class boost::serialization::access
friend

Archiving

Definition at line 58 of file ParameterInstance.hpp.

Member Data Documentation

template<class UNIT >
units::quantity<UNIT> ParameterInstance< UNIT >::mValue
private

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