CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
FWConfiguration Class Reference

#include <Fireworks/Core/interface/FWConfiguration.h>

Public Types

typedef std::vector< std::pair
< std::string, FWConfiguration > > 
KeyValues
 
typedef KeyValues::const_iterator KeyValuesIt
 
typedef std::vector< std::string > StringValues
 
typedef
StringValues::const_iterator 
StringValuesIt
 

Public Member Functions

FWConfigurationaddKeyValue (const std::string &, const FWConfiguration &)
 
FWConfigurationaddKeyValue (const std::string &, FWConfiguration &, bool iDoSwap=false)
 
FWConfigurationaddValue (const std::string &)
 
 FWConfiguration (unsigned int iVersion=1)
 
 FWConfiguration (const std::string &iValue)
 
 FWConfiguration (const FWConfiguration &)
 
const KeyValueskeyValues () const
 
const FWConfigurationoperator= (const FWConfiguration &)
 
const StringValuesstringValues () const
 
void swap (FWConfiguration &)
 
const std::string & value (unsigned int iIndex=0) const
 
const FWConfigurationvalueForKey (const std::string &iKey) const
 
unsigned int version () const
 
virtual ~FWConfiguration ()
 

Private Attributes

boost::scoped_ptr< std::vector
< std::pair< std::string,
FWConfiguration > > > 
m_keyValues
 
boost::scoped_ptr< std::vector
< std::string > > 
m_stringValues
 
unsigned int m_version
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 32 of file FWConfiguration.h.

Member Typedef Documentation

typedef std::vector<std::pair< std::string, FWConfiguration> > FWConfiguration::KeyValues

Definition at line 46 of file FWConfiguration.h.

typedef KeyValues::const_iterator FWConfiguration::KeyValuesIt

Definition at line 47 of file FWConfiguration.h.

typedef std::vector<std::string> FWConfiguration::StringValues

Definition at line 49 of file FWConfiguration.h.

typedef StringValues::const_iterator FWConfiguration::StringValuesIt

Definition at line 50 of file FWConfiguration.h.

Constructor & Destructor Documentation

FWConfiguration::FWConfiguration ( unsigned int  iVersion = 1)
inline

Definition at line 36 of file FWConfiguration.h.

Referenced by addKeyValue().

36  : m_version(iVersion) {
37  }
unsigned int m_version
FWConfiguration::FWConfiguration ( const std::string &  iValue)
inline

Definition at line 38 of file FWConfiguration.h.

38  : m_stringValues(new std::vector<std::string>( 1, iValue) ), m_version(0) {
39  }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
unsigned int m_version
FWConfiguration::~FWConfiguration ( )
virtual

Definition at line 45 of file FWConfiguration.cc.

46 {
47 }
FWConfiguration::FWConfiguration ( const FWConfiguration rhs)

Definition at line 38 of file FWConfiguration.cc.

38  :
39  m_stringValues( rhs.m_stringValues ? new std::vector<std::string>(*(rhs.m_stringValues)) : 0),
40  m_keyValues( rhs.m_keyValues ? new KeyValues(*(rhs.m_keyValues)) : 0),
41  m_version(rhs.m_version)
42 {
43 }
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
boost::scoped_ptr< std::vector< std::string > > m_stringValues
unsigned int m_version
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues

Member Function Documentation

FWConfiguration & FWConfiguration::addKeyValue ( const std::string &  iKey,
const FWConfiguration iConfig 
)

Definition at line 65 of file FWConfiguration.cc.

References m_keyValues, and m_stringValues.

Referenced by addAreaInfoTo(), CmsAnnotation::addTo(), FWEventAnnotation::addTo(), FWCompositeParameter::addTo(), FWLegoViewBase::addTo(), FWTriggerTableView::addTo(), FWEventItemsManager::addTo(), FWTableView::addTo(), FWGenericParameter< T >::addTo(), CmsShowNavigator::addTo(), FWGUIManager::addTo(), FWTableViewManager::addToImpl(), FWEveView::addToOrthoCamera(), FWEveView::addToPerspectiveCamera(), addWindowInfoTo(), and FWConfigurationManager::to().

66 {
67  if( m_stringValues ) {
68  throw std::runtime_error("adding key/value to configuration containing string values");
69  }
70  if(not m_keyValues) {
71  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,iConfig) ) );
72  } else {
73  m_keyValues->push_back(std::make_pair(iKey,iConfig));
74  }
75  return *this;
76 }
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
boost::scoped_ptr< std::vector< std::string > > m_stringValues
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
FWConfiguration & FWConfiguration::addKeyValue ( const std::string &  iKey,
FWConfiguration iConfig,
bool  iDoSwap = false 
)

Definition at line 78 of file FWConfiguration.cc.

References FWConfiguration(), m_keyValues, and m_stringValues.

79 {
80  if( m_stringValues ) {
81  throw std::runtime_error("adding key/value to configuration containing string values");
82  }
83  if( m_stringValues ) {
84  throw std::runtime_error("adding key/value to configuration containing string values");
85  }
86  if(not m_keyValues) {
87  if(not iDoSwap) {
88  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,iConfig) ) );
89  } else {
90  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,FWConfiguration()) ) );
91  m_keyValues->back().second.swap(iConfig);
92  }
93  } else {
94  if(not iDoSwap) {
95  m_keyValues->push_back(std::make_pair(iKey,iConfig));
96  } else {
97  m_keyValues->push_back(std::make_pair(iKey,FWConfiguration()));
98  m_keyValues->back().second.swap(iConfig);
99  }
100  }
101  return *this;
102 }
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
FWConfiguration(unsigned int iVersion=1)
boost::scoped_ptr< std::vector< std::string > > m_stringValues
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
FWConfiguration & FWConfiguration::addValue ( const std::string &  iValue)

Definition at line 105 of file FWConfiguration.cc.

References m_keyValues, and m_stringValues.

Referenced by FWTableViewManager::addToImpl().

106 {
107  if( m_keyValues ) {
108  throw std::runtime_error("adding string value to configuration containing key/value pairs");
109  }
110  if( not m_stringValues ) {
111  m_stringValues.reset( new std::vector<std::string>(1,iValue) );
112  } else {
113  m_stringValues->push_back(iValue);
114  }
115  return *this;
116 }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
const KeyValues* FWConfiguration::keyValues ( ) const
inline

Definition at line 59 of file FWConfiguration.h.

References m_keyValues.

Referenced by FWConfigurationManager::setFrom(), FWCompositeParameter::setFrom(), FWEventItemsManager::setFrom(), CmsShowNavigator::setFrom(), FWGUIManager::setFrom(), and streamTo().

59  {
60  return m_keyValues.get();
61  }
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
const FWConfiguration & FWConfiguration::operator= ( const FWConfiguration rhs)

Definition at line 52 of file FWConfiguration.cc.

References swap(), and cond::rpcobtemp::temp.

53 {
54  //An exception safe implementation is
55  FWConfiguration temp(rhs);
56  swap(temp);
57 
58  return *this;
59 }
void swap(FWConfiguration &)
const StringValues* FWConfiguration::stringValues ( ) const
inline

Definition at line 62 of file FWConfiguration.h.

References m_stringValues.

Referenced by FWTableViewManager::setFrom(), and streamTo().

62  {
63  return m_stringValues.get();
64  }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
void FWConfiguration::swap ( FWConfiguration iRHS)

Definition at line 119 of file FWConfiguration.cc.

References m_keyValues, m_stringValues, m_version, and std::swap().

Referenced by operator=().

120 {
122  m_stringValues.swap(iRHS.m_stringValues);
123  m_keyValues.swap(iRHS.m_keyValues);
124 }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
unsigned int m_version
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
const std::string & FWConfiguration::value ( unsigned int  iIndex = 0) const
const FWConfiguration * FWConfiguration::valueForKey ( const std::string &  iKey) const

Definition at line 139 of file FWConfiguration.cc.

References first, m_keyValues, and m_stringValues.

Referenced by CmsAnnotation::setFrom(), FWEventAnnotation::setFrom(), FWCompositeParameter::setFrom(), FWLegoViewBase::setFrom(), FW3DViewBase::setFrom(), FWRPZView::setFrom(), CmsShowCommon::setFrom(), FWTriggerTableView::setFrom(), FWTableView::setFrom(), FWGenericParameter< T >::setFrom(), FWTableViewManager::setFrom(), CmsShowNavigator::setFrom(), FWGUIManager::setFrom(), FWEveView::setFromOrthoCamera(), FWEveView::setFromPerspectiveCamera(), and FWGUIManager::setWindowInfoFrom().

140 {
141  if( m_stringValues ) {
142  throw std::runtime_error("valueFoKey fails because configuration containing string values");
143  }
144  if(not m_keyValues) {
145  throw std::runtime_error("valueForKey fails becuase no key/values set");
146  }
147  KeyValues::iterator itFind = std::find_if(m_keyValues->begin(),
148  m_keyValues->end(),
149  boost::bind(&std::pair<std::string,FWConfiguration>::first,_1) == iKey);
150  if(itFind == m_keyValues->end()) {
151  return 0;
152  }
153  return &(itFind->second);
154 }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
bool first
Definition: L1TdeRCT.cc:79
boost::scoped_ptr< std::vector< std::pair< std::string, FWConfiguration > > > m_keyValues
unsigned int FWConfiguration::version ( ) const
inline

Member Data Documentation

boost::scoped_ptr<std::vector<std::pair< std::string, FWConfiguration> > > FWConfiguration::m_keyValues
private

Definition at line 80 of file FWConfiguration.h.

Referenced by addKeyValue(), addValue(), keyValues(), swap(), and valueForKey().

boost::scoped_ptr<std::vector<std::string> > FWConfiguration::m_stringValues
private

Definition at line 79 of file FWConfiguration.h.

Referenced by addKeyValue(), addValue(), stringValues(), swap(), value(), and valueForKey().

unsigned int FWConfiguration::m_version
private

Definition at line 81 of file FWConfiguration.h.

Referenced by swap(), and version().