a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> More...
#include <DDConstant.h>
Public Member Functions | |
DDConstant () | |
an uninitialized constant; one can assign an initialized constant to make it valid | |
DDConstant (const DDName &name) | |
a refenrence to a constant | |
DDConstant (const DDName &name, double *value) | |
creation of a new named constant; if it already existed with the given name, it's overwritten with new values | |
operator double () const | |
convert to a double | |
double | value () const |
return the first stored value; does not check boundaries! | |
Static Public Member Functions | |
static void | createConstantsFromEvaluator () |
creates all DDConstants from the variables of the ClhepEvaluator |
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector>
Definition at line 15 of file DDConstant.h.
DDConstant::DDConstant | ( | ) |
an uninitialized constant; one can assign an initialized constant to make it valid
Definition at line 8 of file DDConstant.cc.
: DDBase<DDName,double*>() { }
DDConstant::DDConstant | ( | const DDName & | name | ) |
a refenrence to a constant
Definition at line 11 of file DDConstant.cc.
References DDI::Singleton< I >::instance(), and DDBase< DDName, double * >::prep_.
: DDBase<DDName,double*>() { prep_ = StoreT::instance().create(name); }
DDConstant::DDConstant | ( | const DDName & | name, |
double * | value | ||
) |
creation of a new named constant; if it already existed with the given name, it's overwritten with new values
Definition at line 16 of file DDConstant.cc.
References DDI::Singleton< I >::instance(), and DDBase< DDName, double * >::prep_.
{ prep_ = StoreT::instance().create(name,vals); }
void DDConstant::createConstantsFromEvaluator | ( | ) | [static] |
creates all DDConstants from the variables of the ClhepEvaluator
Definition at line 36 of file DDConstant.cc.
References ClhepEvaluator::eval(), i, DDI::Singleton< I >::instance(), DDBase< DDName, double * >::name(), asciidump::s, ClhepEvaluator::values(), and ClhepEvaluator::variables().
Referenced by DDLSAX2FileHandler::createDDConstants(), and DDStreamer::vars_read().
{ ExprEvalInterface & ev = ExprEvalSingleton::instance(); ClhepEvaluator * eval = dynamic_cast<ClhepEvaluator*>(&ev); if (eval){ const std::vector<std::string> & vars = eval->variables(); const std::vector<std::string> & vals = eval->values(); if (vars.size() != vals.size()) { throw DDException("DDConstants::createConstansFromEvaluator(): different size of variable names & values!") ; } size_t i(0), s(vars.size()); for (; i<s; ++i) { const std::string & sr = vars[i]; typedef std::string::size_type ST; ST i1 = sr.find("___"); DDName name(std::string(sr,i1+3,sr.size()-1),std::string(sr,0,i1)); double* dv = new double; *dv = eval->eval(sr.c_str()); DDConstant cst(name,dv);//(ddname); } } else { throw DDException("DDConstants::createConstansFromEvaluator(): expression-evaluator is not a ClhepEvaluator-implementation!"); } }
DDConstant::operator double | ( | ) | const [inline] |
convert to a double
Definition at line 34 of file DDConstant.h.
References DDBase< DDName, double * >::rep().
{ return rep(); }
double DDConstant::value | ( | ) | const [inline] |
return the first stored value; does not check boundaries!
Definition at line 31 of file DDConstant.h.
References DDBase< DDName, double * >::rep().
Referenced by operator<<().
{ return rep(); }