Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:36

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWCompositeParameter
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Fri Mar  7 14:36:57 EST 2008
0011 //
0012 
0013 // system include files
0014 #include <cassert>
0015 #include <algorithm>
0016 
0017 // user include files
0018 #include "Fireworks/Core/interface/FWCompositeParameter.h"
0019 #include "Fireworks/Core/interface/FWConfiguration.h"
0020 
0021 //
0022 // constants, enums and typedefs
0023 //
0024 
0025 //
0026 // static data member definitions
0027 //
0028 
0029 //
0030 // constructors and destructor
0031 //
0032 FWCompositeParameter::FWCompositeParameter(FWParameterizable* iParent, const std::string& iName, unsigned int iVersion)
0033     : FWParameterBase(iParent, iName), m_version(iVersion) {}
0034 
0035 // FWCompositeParameter::FWCompositeParameter(const FWCompositeParameter& rhs)
0036 // {
0037 //    // do actual copying here;
0038 // }
0039 
0040 FWCompositeParameter::~FWCompositeParameter() {}
0041 
0042 //
0043 // assignment operators
0044 //
0045 // const FWCompositeParameter& FWCompositeParameter::operator=(const FWCompositeParameter& rhs)
0046 // {
0047 //   //An exception safe implementation is
0048 //   FWCompositeParameter temp(rhs);
0049 //   swap(rhs);
0050 //
0051 //   return *this;
0052 // }
0053 
0054 //
0055 // member functions
0056 //
0057 void FWCompositeParameter::setFrom(const FWConfiguration& iFrom) {
0058   //need a way to handle versioning
0059   const FWConfiguration* mine = iFrom.valueForKey(name());
0060   const FWConfiguration::KeyValues* keyVals = mine->keyValues();
0061 
0062   assert(nullptr != mine);
0063   assert(mine->version() == m_version);
0064   assert(nullptr != keyVals);
0065 
0066   for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
0067     (*it)->setFrom(*mine);
0068   }
0069 }
0070 
0071 //
0072 // const member functions
0073 //
0074 void FWCompositeParameter::addTo(FWConfiguration& oTo) const {
0075   FWConfiguration conf(m_version);
0076 
0077   for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
0078     (*it)->addTo(conf);
0079   }
0080   //   std::for_each(begin(), end(),
0081   //                 std::bind(&FWParameterBase::addTo, std::placeholders::_1,conf));
0082 
0083   oTo.addKeyValue(name(), conf, true);
0084 }
0085 
0086 //
0087 // static member functions
0088 //