CMS 3D CMS Logo

FWCompositeParameter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWCompositeParameter
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Fri Mar 7 14:36:57 EST 2008
11 //
12 
13 // system include files
14 #include <cassert>
15 #include <algorithm>
16 
17 // user include files
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
32 FWCompositeParameter::FWCompositeParameter(FWParameterizable* iParent, const std::string& iName, unsigned int iVersion)
33  : FWParameterBase(iParent, iName), m_version(iVersion) {}
34 
35 // FWCompositeParameter::FWCompositeParameter(const FWCompositeParameter& rhs)
36 // {
37 // // do actual copying here;
38 // }
39 
41 
42 //
43 // assignment operators
44 //
45 // const FWCompositeParameter& FWCompositeParameter::operator=(const FWCompositeParameter& rhs)
46 // {
47 // //An exception safe implementation is
48 // FWCompositeParameter temp(rhs);
49 // swap(rhs);
50 //
51 // return *this;
52 // }
53 
54 //
55 // member functions
56 //
58  //need a way to handle versioning
59  const FWConfiguration* mine = iFrom.valueForKey(name());
60  const FWConfiguration::KeyValues* keyVals = mine->keyValues();
61 
62  assert(nullptr != mine);
63  assert(mine->version() == m_version);
64  assert(nullptr != keyVals);
65 
66  for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
67  (*it)->setFrom(*mine);
68  }
69 }
70 
71 //
72 // const member functions
73 //
76 
77  for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
78  (*it)->addTo(conf);
79  }
80  // std::for_each(begin(), end(),
81  // std::bind(&FWParameterBase::addTo, std::placeholders::_1,conf));
82 
83  oTo.addKeyValue(name(), conf, true);
84 }
85 
86 //
87 // static member functions
88 //
FWParameterizable::const_iterator
std::vector< FWParameterBase * >::const_iterator const_iterator
Definition: FWParameterizable.h:34
FWParameterBase
Definition: FWParameterBase.h:31
cms::cuda::assert
assert(be >=bs)
FWParameterizable::end
const_iterator end() const
Definition: FWParameterizable.h:38
FWCompositeParameter.h
FWParameterizable::begin
const_iterator begin() const
Definition: FWParameterizable.h:36
FWConfiguration::KeyValues
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
Definition: FWConfiguration.h:40
FWCompositeParameter::setFrom
void setFrom(const FWConfiguration &) override
Definition: FWCompositeParameter.cc:57
FWConfiguration::valueForKey
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: FWConfiguration.cc:122
FWCompositeParameter::m_version
unsigned int m_version
Definition: FWCompositeParameter.h:48
FWParameterizable
Definition: FWParameterizable.h:29
FWCompositeParameter::~FWCompositeParameter
~FWCompositeParameter() override
Definition: FWCompositeParameter.cc:40
FWParameterBase::name
const std::string & name() const
Definition: FWParameterBase.h:39
FWConfiguration::version
unsigned int version() const
Definition: FWConfiguration.h:49
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWConfiguration::addKeyValue
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
Definition: FWConfiguration.cc:58
FWConfiguration::keyValues
const KeyValues * keyValues() const
Definition: FWConfiguration.h:51
FWCompositeParameter::addTo
void addTo(FWConfiguration &) const override
Definition: FWCompositeParameter.cc:74
FWConfiguration
Definition: FWConfiguration.h:31
FWConfiguration.h
FWCompositeParameter::FWCompositeParameter
FWCompositeParameter(FWParameterizable *iParent, const std::string &iName, unsigned int iVersion=1)
Definition: FWCompositeParameter.cc:32