| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# Gaudi::Parsers::Catalogue Class Reference

`#include <Catalogue.h>`

List of all members.

## Detailed Description

Catalogue of PropertyEntry.

Author:
  : Alexander Mazurov

Date:
  : 2006-02-17

Definition at line 47 of file Catalogue.h.

## Public Types
typedef std::map< std::string, std::vector< PropertyEntry > > | CatalogueT
## Public Member Functions
StatusCode | findProperties (const std::string &objName, std::vector< PropertyEntry > &list) const
| Find properties of object by object name.
StatusCode | findProperty (const std::string &objName, const std::string &propName, PropertyEntry &property) const
| Find property in catalogue.
void | addProperty (const std::string &objName, const PropertyEntry &property)
| Add property to catalogue.
StatusCode | addProperty (const std::string &objName, const std::string &propName, const std::string &value)
| Add property to catalogue.
CatalogueT | catalogue () const
| Return all objects names and their properties info.
std::ostream & | fillStream (std::ostream &out) const
| print the content of the catalogue to std::ostream
## Private Types
typedef std::map< std::string, PropertyEntry, _NoCaseCmp_ > | PropertiesStoreT
typedef std::map< std::string, PropertiesStoreT > | ObjectsStoreT
## Private Attributes
ObjectsStoreT | m_properties

## Member Typedef Documentation

typedef std::map<std::string,std::vector<PropertyEntry> > Gaudi::Parsers::Catalogue::CatalogueT

Definition at line 50 of file Catalogue.h.

typedef std::map<std::string,PropertyEntry,_NoCaseCmp_> Gaudi::Parsers::Catalogue::PropertiesStoreT`[private]`

Definition at line 92 of file Catalogue.h.

typedef std::map<std::string,PropertiesStoreT> Gaudi::Parsers::Catalogue::ObjectsStoreT`[private]`

Definition at line 93 of file Catalogue.h.

## Member Function Documentation

StatusCode Gaudi::Parsers::Catalogue::findProperties | ( | const std::string & | objName,
|  | std::vector< PropertyEntry > & | list |
| ) |  |  | const

Find properties of object by object name.

Returns:
  StatusCode::SUCCESS if catalogue contains object properties

Parameters:

  | objName | Object name
  | list | Result list

Definition at line 28 of file Catalogue.cpp.

    00030 {
    00031   ObjectsStoreT::const_iterator obj =
    00032     m_properties.find(objName);
    00033   if ( obj == m_properties.end()){ return StatusCode::FAILURE; }
    00034   PropertiesStoreT::const_iterator cur = obj->second.begin();
    00035   PropertiesStoreT::const_iterator end = obj->second.end();
    00036   for(;cur!=end;cur++){ lst.push_back(cur->second); }
    00037   return StatusCode::SUCCESS;
    00038 }

StatusCode Gaudi::Parsers::Catalogue::findProperty | ( | const std::string & | objName,
|  | const std::string & | propName,
|  | PropertyEntry & | property |
| ) |  |  | const

Find property in catalogue.

Returns:
  StatusCode::SUCCESS - if catalogue contains property

Parameters:

  | objName | Object name
  | propName | Property name
  | property |

Definition at line 50 of file Catalogue.cpp.

    00053 {
    00054   ObjectsStoreT::const_iterator obj = m_properties.find(objName);
    00055   if ( obj == m_properties.end()){ return StatusCode::FAILURE; }
    00056   PropertiesStoreT::const_iterator prop = obj->second.find(propName);
    00057   if ( prop==obj->second.end()){ return StatusCode::FAILURE; }
    00058   property = prop->second;
    00059   return StatusCode::SUCCESS;
    00060 }

void Gaudi::Parsers::Catalogue::addProperty | ( | const std::string & | objName,
|  | const PropertyEntry & | property |
| ) |  |  |

Add property to catalogue.

Parameters:

  | objName | Name of object
  | property | Property

Definition at line 92 of file Catalogue.cpp.

    00094 {
    00095   PropertyEntry prop = property;
    00096   prop.removeEnv().ignore() ;
    00097   m_properties[objName][ property.name()] = prop;
    00098 }

StatusCode Gaudi::Parsers::Catalogue::addProperty | ( | const std::string & | objName,
|  | const std::string & | propName,
|  | const std::string & | value |
| ) |  |  |

Add property to catalogue.

Parameters:

  | objName | Name of object
  | propName | Property name
  | Value | as string

Definition at line 109 of file Catalogue.cpp.

    00112 {
    00113   StatusCode ok;
    00114   std::string stringResult;
    00115   std::vector<std::string> vectorResult;
    00116   ok = Gaudi::Parsers::Utils::parseValue(value,stringResult,vectorResult);
    00117   if(ok.isFailure()){
    00118     return StatusCode::FAILURE;
    00119   }
    00120   bool isVector = (vectorResult.size()>0) || (stringResult=="{}");
    00121   if(isVector){
    00122     addProperty(objName,PropertyEntry(propName,vectorResult));
    00123   }else{
    00124      addProperty(objName,PropertyEntry(propName,stringResult));
    00125   }
    00126   return StatusCode::SUCCESS;
    00127 }

Gaudi::Parsers::Catalogue::CatalogueT Gaudi::Parsers::Catalogue::catalogue | ( |  | ) | const

Return all objects names and their properties info.

Returns:
  objects names and their properties info

Definition at line 68 of file Catalogue.cpp.

    00069 {
    00070   CatalogueT result;
    00071   for(ObjectsStoreT::const_iterator curObj=m_properties.begin();
    00072     curObj!=m_properties.end();curObj++){
    00073     std::vector<PropertyEntry> properties;
    00074       for(PropertiesStoreT::const_iterator curProp=curObj->second.begin();
    00075         curProp!=curObj->second.end();curProp++){
    00076           properties.push_back(curProp->second);
    00077        }
    00078      result[curObj->first] = properties;
    00079    }
    00080    return result;
    00081 }

std::ostream & Gaudi::Parsers::Catalogue::fillStream | ( | std::ostream & | out | ) | const

print the content of the catalogue to std::ostream

Definition at line 138 of file Catalogue.cpp.

    00139 {
    00140   o << "// " << std::string(82,'=') << std::endl
    00141     << "//       Parser catalogue " << std::endl
    00142     << "// " << std::string(82,'=') << std::endl ;
    00143
    00144   size_t nComponents = 0 ;
    00145   size_t nProperties = 0 ;
    00146
    00147   CatalogueT cat = catalogue();
    00148   for( Catalogue::CatalogueT::const_iterator obj = cat.begin();
    00149        cat.end() != obj ; ++obj )
    00150   {
    00151     o << boost::format("// Properties of '%1%' %|40t|#=%2%" )
    00152       % obj->first % obj->second.size() << std::endl ;
    00153     ++nComponents ;
    00154     nProperties += obj->second.size() ;
    00155     for( std::vector<PropertyEntry>::const_iterator prop = obj->second.begin();
    00156          obj->second.end() != prop ; ++prop )
    00157     {
    00158       o << boost::format("%1%.%2%   %|44t| = %3% ; ")
    00159         % obj->first
    00160         % prop->name()
    00161         % prop->value() << std::endl ;
    00162     }
    00163   }
    00164   o << "// " << std::string(82,'=') << std::endl
    00165     << boost::format("// End parser catalogue #Components=%1% #Properties=%2%")
    00166     % nComponents % nProperties     << std::endl
    00167     << "// " << std::string(82,'=') << std::endl ;
    00168
    00169   return o ;
    00170 }

## Member Data Documentation

ObjectsStoreT Gaudi::Parsers::Catalogue::m_properties`[private]`

Definition at line 95 of file Catalogue.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiSvc/src/JobOptionsSvc/Catalogue.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiSvc/src/JobOptionsSvc/Catalogue.cpp