CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

FWConfiguration Class Reference

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

List of all members.

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 FWConfiguration &)
 FWConfiguration (const std::string &iValue)
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 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().

                                            : m_version(iVersion) {
   }
FWConfiguration::FWConfiguration ( const std::string &  iValue) [inline]

Definition at line 38 of file FWConfiguration.h.

                                            : m_stringValues(new std::vector<std::string>( 1, iValue) ), m_version(0) {
   }
FWConfiguration::~FWConfiguration ( ) [virtual]

Definition at line 45 of file FWConfiguration.cc.

{
}
FWConfiguration::FWConfiguration ( const FWConfiguration rhs)

Definition at line 38 of file FWConfiguration.cc.

                                                           :
   m_stringValues( rhs.m_stringValues ? new std::vector<std::string>(*(rhs.m_stringValues)) : 0),
   m_keyValues( rhs.m_keyValues ? new KeyValues(*(rhs.m_keyValues)) : 0),
   m_version(rhs.m_version)
{
}

Member Function Documentation

FWConfiguration & FWConfiguration::addKeyValue ( const std::string &  iKey,
const FWConfiguration iConfig 
)
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.

{
   if( m_stringValues ) {
      throw std::runtime_error("adding key/value to configuration containing string values");
   }
   if( m_stringValues ) {
      throw std::runtime_error("adding key/value to configuration containing string values");
   }
   if(not m_keyValues) {
      if(not iDoSwap) {
         m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,iConfig) ) );
      } else {
         m_keyValues.reset(new KeyValues(1, std::make_pair(iKey,FWConfiguration()) ) );
         m_keyValues->back().second.swap(iConfig);
      }
   } else {
      if(not iDoSwap) {
         m_keyValues->push_back(std::make_pair(iKey,iConfig));
      } else {
         m_keyValues->push_back(std::make_pair(iKey,FWConfiguration()));
         m_keyValues->back().second.swap(iConfig);
      }
   }
   return *this;
}
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().

{
   if( m_keyValues ) {
      throw std::runtime_error("adding string value to configuration containing key/value pairs");
   }
   if( not m_stringValues ) {
      m_stringValues.reset( new std::vector<std::string>(1,iValue) );
   } else {
      m_stringValues->push_back(iValue);
   }
   return *this;
}
const KeyValues* FWConfiguration::keyValues ( ) const [inline]
FWConfiguration & FWConfiguration::operator= ( const FWConfiguration rhs)

Definition at line 52 of file FWConfiguration.cc.

References swap(), and groupFilesInBlocks::temp.

{
   //An exception safe implementation is
   FWConfiguration temp(rhs);
   swap(temp);

   return *this;
}
const StringValues* FWConfiguration::stringValues ( ) const [inline]

Definition at line 62 of file FWConfiguration.h.

References m_stringValues.

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

                                            {
      return m_stringValues.get();
   }
void FWConfiguration::swap ( FWConfiguration iRHS)

Definition at line 119 of file FWConfiguration.cc.

References m_keyValues, m_stringValues, and m_version.

Referenced by operator=().

const std::string & FWConfiguration::value ( unsigned int  iIndex = 0) const
const FWConfiguration * FWConfiguration::valueForKey ( const std::string &  iKey) const
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().