CMS 3D CMS Logo

FWConfiguration.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWConfiguration_h
2 #define Fireworks_Core_FWConfiguration_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWConfiguration
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri Feb 22 15:54:22 EST 2008
19 //
20 
21 // system include files
22 #include <vector>
23 #include <memory>
24 #include <string>
25 #include <ostream>
26 
27 // user include files
28 
29 // forward declarations
30 
32 public:
33  FWConfiguration(unsigned int iVersion = 1) : m_version(iVersion) {}
34  FWConfiguration(const std::string& iValue) : m_stringValues(new std::vector<std::string>(1, iValue)), m_version(0) {}
35  virtual ~FWConfiguration();
36 
37  FWConfiguration(const FWConfiguration&); // stop default
38 
39  FWConfiguration& operator=(const FWConfiguration&); // stop default
40  typedef std::vector<std::pair<std::string, FWConfiguration> > KeyValues;
41  typedef KeyValues::const_iterator KeyValuesIt;
42 
43  typedef std::vector<std::string> StringValues;
44  typedef StringValues::const_iterator StringValuesIt;
45 
46  // ---------- const member functions ---------------------
47  const std::string& value(unsigned int iIndex = 0) const;
48  const FWConfiguration* valueForKey(const std::string& iKey) const;
49  unsigned int version() const { return m_version; }
50 
51  const KeyValues* keyValues() const { return m_keyValues.get(); }
52  const StringValues* stringValues() const { return m_stringValues.get(); }
53 
54  // ---------- static member functions --------------------
55 
56  // ---------- member functions ---------------------------
58  FWConfiguration& addKeyValue(const std::string&, FWConfiguration&, bool iDoSwap = false);
60  void swap(FWConfiguration&);
61 
62  static void streamTo(std::ostream& oTo, const FWConfiguration& iConfig, const std::string& name);
63 
64 private:
65  // ---------- member data --------------------------------
66 
67  std::unique_ptr<std::vector<std::string> > m_stringValues;
68  std::unique_ptr<std::vector<std::pair<std::string, FWConfiguration> > > m_keyValues;
69  unsigned int m_version;
70 };
71 
72 void streamTo(std::ostream&, const FWConfiguration&, const std::string& name);
73 
74 #endif
FWConfiguration::streamTo
static void streamTo(std::ostream &oTo, const FWConfiguration &iConfig, const std::string &name)
Definition: FWConfiguration.cc:196
FWConfiguration::swap
void swap(FWConfiguration &)
Definition: FWConfiguration.cc:106
FWConfiguration::KeyValues
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
Definition: FWConfiguration.h:40
streamTo
void streamTo(std::ostream &, const FWConfiguration &, const std::string &name)
FWConfiguration::m_version
unsigned int m_version
Definition: FWConfiguration.h:69
FWConfiguration::FWConfiguration
FWConfiguration(const std::string &iValue)
Definition: FWConfiguration.h:34
FWConfiguration::KeyValuesIt
KeyValues::const_iterator KeyValuesIt
Definition: FWConfiguration.h:41
FWConfiguration::valueForKey
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: FWConfiguration.cc:122
FWConfiguration::value
const std::string & value(unsigned int iIndex=0) const
Definition: FWConfiguration.cc:115
FWConfiguration::addValue
FWConfiguration & addValue(const std::string &)
Definition: FWConfiguration.cc:94
FWConfiguration::StringValuesIt
StringValues::const_iterator StringValuesIt
Definition: FWConfiguration.h:44
FWConfiguration::operator=
FWConfiguration & operator=(const FWConfiguration &)
Definition: FWConfiguration.cc:47
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
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::FWConfiguration
FWConfiguration(unsigned int iVersion=1)
Definition: FWConfiguration.h:33
std
Definition: JetResolutionObject.h:76
FWConfiguration::keyValues
const KeyValues * keyValues() const
Definition: FWConfiguration.h:51
FWConfiguration::m_keyValues
std::unique_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
Definition: FWConfiguration.h:68
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWConfiguration::m_stringValues
std::unique_ptr< std::vector< std::string > > m_stringValues
Definition: FWConfiguration.h:67
FWConfiguration::stringValues
const StringValues * stringValues() const
Definition: FWConfiguration.h:52
FWConfiguration
Definition: FWConfiguration.h:31
FWConfiguration::StringValues
std::vector< std::string > StringValues
Definition: FWConfiguration.h:43
FWConfiguration::~FWConfiguration
virtual ~FWConfiguration()
Definition: FWConfiguration.cc:42