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
 
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 31 of file FWConfiguration.h.

Member Typedef Documentation

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

Definition at line 45 of file FWConfiguration.h.

typedef KeyValues::const_iterator FWConfiguration::KeyValuesIt

Definition at line 46 of file FWConfiguration.h.

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

Definition at line 48 of file FWConfiguration.h.

typedef StringValues::const_iterator FWConfiguration::StringValuesIt

Definition at line 49 of file FWConfiguration.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file FWConfiguration.h.

Referenced by addKeyValue().

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

Definition at line 37 of file FWConfiguration.h.

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

Definition at line 44 of file FWConfiguration.cc.

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

Definition at line 37 of file FWConfiguration.cc.

37  :
38  m_stringValues( rhs.m_stringValues ? new std::vector<std::string>(*(rhs.m_stringValues)) : 0),
39  m_keyValues( rhs.m_keyValues ? new KeyValues(*(rhs.m_keyValues)) : 0),
40  m_version(rhs.m_version)
41 {
42 }
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 64 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(), FWProxyBuilderConfiguration::addTo(), FWTableView::addTo(), FWGenericParameter< T >::addTo(), FWGeometryTableViewBase::addTo(), CmsShowNavigator::addTo(), FWGUIManager::addTo(), FWTableViewManager::addToImpl(), FWEveView::addToOrthoCamera(), FWEveView::addToPerspectiveCamera(), addWindowInfoTo(), FWEventItemsManager::setFrom(), and FWConfigurationManager::to().

65 {
66  if( m_stringValues ) {
67  throw std::runtime_error("adding key/value to configuration containing string values");
68  }
69  if(not m_keyValues) {
70  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,iConfig) ) );
71  } else {
72  m_keyValues->push_back(std::make_pair(iKey,iConfig));
73  }
74  return *this;
75 }
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 77 of file FWConfiguration.cc.

References FWConfiguration(), m_keyValues, and m_stringValues.

78 {
79  if( m_stringValues ) {
80  throw std::runtime_error("adding key/value to configuration containing string values");
81  }
82  if( m_stringValues ) {
83  throw std::runtime_error("adding key/value to configuration containing string values");
84  }
85  if(not m_keyValues) {
86  if(not iDoSwap) {
87  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,iConfig) ) );
88  } else {
89  m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,FWConfiguration()) ) );
90  m_keyValues->back().second.swap(iConfig);
91  }
92  } else {
93  if(not iDoSwap) {
94  m_keyValues->push_back(std::make_pair(iKey,iConfig));
95  } else {
96  m_keyValues->push_back(std::make_pair(iKey,FWConfiguration()));
97  m_keyValues->back().second.swap(iConfig);
98  }
99  }
100  return *this;
101 }
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 104 of file FWConfiguration.cc.

References m_keyValues, and m_stringValues.

Referenced by FWTableViewManager::addToImpl().

105 {
106  if( m_keyValues ) {
107  throw std::runtime_error("adding string value to configuration containing key/value pairs");
108  }
109  if( not m_stringValues ) {
110  m_stringValues.reset( new std::vector<std::string>(1,iValue) );
111  } else {
112  m_stringValues->push_back(iValue);
113  }
114  return *this;
115 }
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
FWConfiguration & FWConfiguration::operator= ( const FWConfiguration rhs)

Definition at line 51 of file FWConfiguration.cc.

References swap(), and groupFilesInBlocks::temp.

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

Definition at line 61 of file FWConfiguration.h.

References m_stringValues.

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

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

Definition at line 118 of file FWConfiguration.cc.

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

Referenced by operator=().

119 {
121  m_stringValues.swap(iRHS.m_stringValues);
122  m_keyValues.swap(iRHS.m_keyValues);
123 }
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

Definition at line 129 of file FWConfiguration.cc.

References m_stringValues.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), average.Average::average(), Vispa.Views.PropertyView.FileProperty::buttonClicked(), Types.string::configValue(), Types.FileInPath::configValue(), Mixins.UsingBlock::dumpPython(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Mixins.UsingBlock::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), Vispa.Views.PropertyView.FileProperty::labelDoubleClicked(), CmsAnnotation::setFrom(), FWEventAnnotation::setFrom(), FWLegoViewBase::setFrom(), FWRPZView::setFrom(), FW3DViewBase::setFrom(), CmsShowCommon::setFrom(), FWTriggerTableView::setFrom(), FWTableView::setFrom(), CmsShowNavigator::setFrom(), FWGUIManager::setFrom(), FWEveView::setFromOrthoCamera(), FWEveView::setFromPerspectiveCamera(), FWGeometryTableViewBase::setTopNodePathFromConfig(), and FWGUIManager::setWindowInfoFrom().

130 {
131  if( not m_stringValues ) {
132  throw std::runtime_error("no string values set");
133  }
134  return m_stringValues->at(iIndex);
135 }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
const FWConfiguration * FWConfiguration::valueForKey ( const std::string &  iKey) const

Definition at line 138 of file FWConfiguration.cc.

References plotBeamSpotDB::first, m_keyValues, and m_stringValues.

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

139 {
140  if( m_stringValues ) {
141  throw std::runtime_error("valueFoKey fails because configuration containing string values");
142  }
143  if(not m_keyValues) {
144  throw std::runtime_error("valueForKey fails becuase no key/values set");
145  }
146  KeyValues::iterator itFind = std::find_if(m_keyValues->begin(),
147  m_keyValues->end(),
148  boost::bind(&std::pair<std::string,FWConfiguration>::first,_1) == iKey);
149  if(itFind == m_keyValues->end()) {
150  return 0;
151  }
152  return &(itFind->second);
153 }
boost::scoped_ptr< std::vector< std::string > > m_stringValues
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 79 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 78 of file FWConfiguration.h.

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

unsigned int FWConfiguration::m_version
private

Definition at line 80 of file FWConfiguration.h.

Referenced by swap(), and version().