Class xlifepp::Parameters#

class Parameters#

Collaboration diagram for xlifepp::Parameters:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "4" [label="std::map< string_t, number_t >" tooltip="std::map< string_t, number_t >"] "5" [label="std::map< K, T >" tooltip="std::map< K, T >"] "3" [label="std::vector< T >" tooltip="std::vector< T >"] "2" [label="std::vector< xlifepp::Parameter * >" tooltip="std::vector< xlifepp::Parameter * >"] "1" [label="xlifepp::Parameters" tooltip="xlifepp::Parameters" fillcolor="#BFBFBF"] "4" -> "5" [dir=forward tooltip="template-instance"] "2" -> "3" [dir=forward tooltip="template-instance"] "1" -> "2" [dir=forward tooltip="usage"] "1" -> "4" [dir=forward tooltip="usage"] }

encapsulates a list of Parameter’s.

creation:

Parameter height=3;
Parameters data;
data << height << Parameter(4,"width") << "case 1" << 1.5;

string_t “case 1” has default name “parameter3” real_t “1.5” has default name “parameter4”

usage:

Parameter a=data("height");  // access by name, contains height
Parameter c=data(4);         // access by rank, contains 1.5
data(1)= 2;                  // replace the value 3 by 2
data("height")=2;            // same effect
data(height)=2;              // same effect, caution here as object height is hereafter modified
double x=data(4);            // x contains 1.5
x=data("width");             // x contains 4

No deletion of list element is possible No algebraic operations are performed on Parameters Automatic parameter naming is a crutch for tired users, it is advised that the user manages names of parameters:

Parameter height=3;
Parameter width=4;
Parameter wavenumber=1.5;
Parameter comment="case 1";
Parameters data;
data << height << width << wavenumber << comment;

Public Functions

Parameters()#

default constructor

Parameters(const Parameters&)#

copy constructor with full copy behavior

template<typename T>
inline Parameters(const T &t, const string_t &nm, const Strings &snm)#

constructor with T type

template<typename T>
inline Parameters(const T &t, const string_t &nm = string_t(""), const string_t &snm = string_t(""))#

constructor with T type

Parameters(const void*, const string_t &nm, const Strings &snm)#

constructor with a void pointer

Parameters(const void*, const string_t &nm = string_t(""), const string_t &snm = string_t(""))#

constructor with a void pointer

Parameters(Parameter&)#

constructor with a Parameter

~Parameters()#

destructor

template<typename K>
inline void add(const string_t &name, const K &value)#

adds a parameter by its name and value

inline void associateVector(const string_t &un, number_t d = 3)#

associate to the parameters a vector

bool contains(const char *s) const#

check whether Parameter named s is in Parameter

bool contains(const Parameter&) const#

check whether Parameter is in Parameters

bool contains(const Parameter*) const#

check whether Parameter is in Parameters

bool contains(const string_t &s) const#

check whether Parameter named s is in Parameter

template<typename K>
inline K get(const char *name, K value)#

gets a parameter from a name (non const)

template<typename K>
inline K get(const char *name, K value) const#

gets a parameter from a name (const)

template<typename K>
inline K get(const string_t &name, K value)#

gets a parameter from a name (non const)

template<typename K>
inline K get(const string_t &name, K value) const#

gets a parameter from a name (const)

Parameter &getFromShortName(const char *s) const#

access by shortname

Parameter &getFromShortName(const string_t &s) const#

access by shortname

inline const Vector<real_t> &getVector(const string_t &un) const#

get unitary vector (“_n”,”_nx”,”_ny”,…)

inline const Vector<real_t> &getVector(UnitaryVector uv) const#

get unitary vector (_n,_nx,_ny,…)

Parameter &operator()(const char *s) const#

access by name (char *)

Parameter &operator()(const number_t n) const#

access by rank >=1

Parameter &operator()(const Parameter &p) const#

access by object

Parameter &operator()(const string_t &s) const#

access by name (string)

Parameters &operator<<(const Parameter&)#

insert a parameter into list via stream

Parameters &operator<<(const void*)#

insert a void pointer into list via stream

Parameters &operator<<(Parameter&)#

insert a parameter into list via stream

Parameters &operator<<(Parameter*)#

insert a parameter into list via stream

Parameters &operator=(const Parameters &pars)#

assign operator with full copy behavior

void push(const Parameters&)#

append a list of parameters

void push(Parameter&)#

append a parameter into list

int safeInt(const string_t &s, int def = 0) const#

special safe access to some internal int parameters, return def value if not exist

special safe access to some int parameters

inline number_t size() const#

return the number of parameters

Public Members

bool freeParams_#

flag to delete parameter pointers

std::vector<Parameter*> list_#

parameters (pointer) list

Friends

friend std::ostream &operator<<(std::ostream&, const Parameters&)#

flux insertion (write)