CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
DDConstant Class Reference

a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> More...

#include <DDConstant.h>

Inheritance diagram for DDConstant:
DDBase< DDName, double * >

Public Member Functions

 DDConstant ()
 an uninitialized constant; one can assign an initialized constant to make it valid More...
 
 DDConstant (const DDName &name)
 a refenrence to a constant More...
 
 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 More...
 
 operator double () const
 convert to a double More...
 
double value () const
 return the first stored value; does not check boundaries! More...
 
- Public Member Functions inherited from DDBase< DDName, double * >
 DDBase ()
 
const DDNameddname () const
 
def_type isDefined () const
 
bool isValid () const
 true, if the wrapped pointer is valid More...
 
const DDNamename () const
 
 operator bool () const
 
bool operator< (const DDBase &b) const
 
bool operator== (const DDBase &b) const
 
bool operator> (const DDBase &b) const
 
const DDI::rep_traits< DDName, double * >::reference rep () const
 
DDI::rep_traits< DDName, double * >::reference rep ()
 
std::string toString () const
 
const DDI::rep_traits< DDName, double * >::reference val () const
 
const DDI::rep_traits< DDName, double * >::reference val ()
 
virtual ~DDBase ()
 

Static Public Member Functions

static void createConstantsFromEvaluator ()
 creates all DDConstants from the variables of the ClhepEvaluator More...
 
- Static Public Member Functions inherited from DDBase< DDName, double * >
static auto begin ()
 
static void clear ()
 
static auto end ()
 
static size_t size ()
 

Additional Inherited Members

- Public Types inherited from DDBase< DDName, double * >
typedef std::pair< const DDName *, bool > def_type
 
typedef double * pimpl_type
 
typedef DDI::rep_type< DDName, pimpl_type > * prep_type
 
typedef DDI::Singleton< DDI::Store< DDName, double * > > StoreT
 
- Protected Attributes inherited from DDBase< DDName, double * >
prep_type prep_
 

Detailed Description

a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector>

Definition at line 16 of file DDConstant.h.

Constructor & Destructor Documentation

DDConstant::DDConstant ( )

an uninitialized constant; one can assign an initialized constant to make it valid

Definition at line 11 of file DDConstant.cc.

DDConstant::DDConstant ( const DDName name)

a refenrence to a constant

Definition at line 13 of file DDConstant.cc.

References DDI::Singleton< I >::instance(), and DDBase< DDName, double * >::prep_.

14 {
15  prep_ = StoreT::instance().create(name);
16 }
static value_type & instance()
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 18 of file DDConstant.cc.

References DDI::Singleton< I >::instance(), and DDBase< DDName, double * >::prep_.

19 {
20  prep_ = StoreT::instance().create(name,vals);
21 }
static value_type & instance()

Member Function Documentation

void DDConstant::createConstantsFromEvaluator ( void  )
static

creates all DDConstants from the variables of the ClhepEvaluator

Definition at line 37 of file DDConstant.cc.

References Exception, runEdmFileComparison::found, DDI::Singleton< I >::instance(), DDBase< DDName, double * >::name(), AlCaHLTBitMon_QueryRunRegistry::string, and create_public_pileup_plots::vals.

Referenced by DDLSAX2FileHandler::createDDConstants().

38 {
40  const auto& vars = eval.variables();
41  const auto& vals = eval.values();
42  if( vars.size() != vals.size()) {
43  throw cms::Exception( "DDException" )
44  << "DDConstants::createConstansFromEvaluator(): different size of variable names & values!";
45  }
46  for( const auto& it : vars ) {
47  auto found = it.find( "___" );
48  DDName name( std::string( it, found + 3, it.size() - 1 ), std::string( it, 0, found ));
49  double* dv = new double;
50  *dv = eval.eval( it.c_str());
51  DDConstant cst( name, dv );
52  }
53 }
const DDName & name() const
Definition: DDBase.h:78
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static value_type & instance()
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDConstant.h:16
DDConstant::operator double ( ) const
inline

convert to a double

Definition at line 35 of file DDConstant.h.

References DDBase< DDName, double * >::rep().

35 { return rep(); }
const DDI::rep_traits< DDName, double * >::reference rep() const
Definition: DDBase.h:84
double DDConstant::value ( ) const
inline