GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions
GGSParameters Class Reference

Class for storing parameters. More...

#include <GGSParameters.h>

Inheritance diagram for GGSParameters:
Inheritance graph
[legend]

Public Member Functions

 GGSParameters ()
 Default constructor.
 
 GGSParameters (GGSParameters &&params)
 Move constructor.
 
template<typename T >
void SetParam (const std::string &name, T value)
 Sets a parameter. More...
 
template<class T >
GetParam (const std::string &name) const
 Gets a parameter. More...
 
bool AreSameParamsAs (const GGSParameters &params) const
 Compares two parameter objects. More...
 
GGSParametersoperator= (const GGSParameters &rhs)
 Assignment operator. More...
 
template<>
void SetParam (const std::string &name, int value)
 
template<>
void SetParam (const std::string &name, double value)
 
template<>
void SetParam (const std::string &name, bool value)
 
template<>
int GetParam (const std::string &name) const
 
template<>
double GetParam (const std::string &name) const
 
template<>
bool GetParam (const std::string &name) const
 

Detailed Description

Class for storing parameters.

This class provides key-value storage for parameters of different types. Currently supported type are:

and std::vector of the above types.

Definition at line 29 of file GGSParameters.h.

Member Function Documentation

bool GGSParameters::AreSameParamsAs ( const GGSParameters params) const

Compares two parameter objects.

This method returns true if the parameters of the argument object are identical in number, names and values to those of this object.

(Note: this method is defined for similarity with GGSTSimInfo::IsSameSimAs, instead of defining GGSParameters::operator= )

Parameters
paramsThe parameters object to be compared with this.
Returns
true if #params carries the same parameters as this.

Definition at line 133 of file GGSParameters.cpp.

133  {
134  if (&params == this)
135  return true;
136  return ((_intParams == params._intParams) && (_doubleParams == params._doubleParams) &&
137  (_stringParams == params._stringParams) && (_boolParams == params._boolParams) &&
138  (_vectIntParams == params._vectIntParams) && (_vectDoubleParams == params._vectDoubleParams) &&
139  (_vectStringParams == params._vectStringParams) && (_vectBoolParams == params._vectBoolParams));
140 }
template<class T >
T GGSParameters::GetParam ( const std::string &  name) const

Gets a parameter.

Parameters
nameThe name of the desired parameter.
Returns
The value of the desired parameter
Exceptions
std::runtime_errorif the requested parameter does not exist.
GGSParameters & GGSParameters::operator= ( const GGSParameters rhs)

Assignment operator.

Parameters
rhsThe parameters object to assign from.
Returns
The parameters object after assignment

Definition at line 142 of file GGSParameters.cpp.

142  {
143  _intParams = rhs._intParams;
144  _doubleParams = rhs._doubleParams;
145  _stringParams = rhs._stringParams;
146  _boolParams = rhs._boolParams;
147  _vectIntParams = rhs._vectIntParams;
148  _vectDoubleParams = rhs._vectDoubleParams;
149  _vectStringParams = rhs._vectStringParams;
150  _vectBoolParams = rhs._vectBoolParams;
151  return *this;
152 }
template<typename T >
void GGSParameters::SetParam ( const std::string &  name,
value 
)

Sets a parameter.

Parameters
nameThe name of the parameter.
valueThe value of the parameter
Exceptions
std::runtime_errorif the parameter cannot be set.

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