Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011
Public Types | Public Member Functions | Private Types | Private Attributes

Gaudi::Parsers::Catalogue Class Reference

Catalogue of PropertyEntry. More...

#include <Catalogue.h>

Collaboration diagram for Gaudi::Parsers::Catalogue:
Collaboration graph
[legend]

List of all members.

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::ostreamfillStream (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

Detailed Description

Catalogue of PropertyEntry.

Author:
: Alexander Mazurov
Date:
: 2006-02-17

Definition at line 47 of file Catalogue.h.


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,PropertiesStoreT> Gaudi::Parsers::Catalogue::ObjectsStoreT [private]

Definition at line 93 of file Catalogue.h.

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

Definition at line 92 of file Catalogue.h.


Member Function Documentation

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

Add property to catalogue.

Parameters:
objNameName of object
propertyProperty

Definition at line 92 of file Catalogue.cpp.

{
  PropertyEntry prop = property;
  prop.removeEnv().ignore() ;
  m_properties[objName][ property.name()] = prop;
}
StatusCode Gaudi::Parsers::Catalogue::addProperty ( const std::string objName,
const std::string propName,
const std::string value 
)

Add property to catalogue.

Parameters:
objNameName of object
propNameProperty name
Valueas string

Definition at line 109 of file Catalogue.cpp.

{
  StatusCode ok;
  std::string stringResult;
  std::vector<std::string> vectorResult;
  ok = Gaudi::Parsers::Utils::parseValue(value,stringResult,vectorResult);
  if(ok.isFailure()){
    return StatusCode::FAILURE;
  }
  bool isVector = (vectorResult.size()>0) || (stringResult=="{}");
  if(isVector){
    addProperty(objName,PropertyEntry(propName,vectorResult));
  }else{
     addProperty(objName,PropertyEntry(propName,stringResult));        
  }
  return StatusCode::SUCCESS;
}
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.

{
  CatalogueT result;
  for(ObjectsStoreT::const_iterator curObj=m_properties.begin();
    curObj!=m_properties.end();curObj++){
    std::vector<PropertyEntry> properties;
      for(PropertiesStoreT::const_iterator curProp=curObj->second.begin();
        curProp!=curObj->second.end();curProp++){
          properties.push_back(curProp->second);
       }      
     result[curObj->first] = properties;
   }
   return result;
}
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.

{
  o << "// " << std::string(82,'=') << std::endl 
    << "//       Parser catalogue " << std::endl 
    << "// " << std::string(82,'=') << std::endl ;
  
  size_t nComponents = 0 ;
  size_t nProperties = 0 ;
  
  CatalogueT cat = catalogue();
  for( Catalogue::CatalogueT::const_iterator obj = cat.begin();
       cat.end() != obj ; ++obj )
  {
    o << boost::format("// Properties of '%1%' %|40t|#=%2%" ) 
      % obj->first % obj->second.size() << std::endl ;
    ++nComponents ;
    nProperties += obj->second.size() ;
    for( std::vector<PropertyEntry>::const_iterator prop = obj->second.begin(); 
         obj->second.end() != prop ; ++prop )
    {
      o << boost::format("%1%.%2%   %|44t| = %3% ; ") 
        % obj->first
        % prop->name()
        % prop->value() << std::endl ;
    }
  }
  o << "// " << std::string(82,'=') << std::endl
    << boost::format("// End parser catalogue #Components=%1% #Properties=%2%")
    % nComponents % nProperties     << std::endl 
    << "// " << std::string(82,'=') << std::endl ;
  
  return o ; 
}
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:
objNameObject name
listResult list

Definition at line 28 of file Catalogue.cpp.

{
  ObjectsStoreT::const_iterator obj = 
    m_properties.find(objName);
  if ( obj == m_properties.end()){ return StatusCode::FAILURE; }
  PropertiesStoreT::const_iterator cur = obj->second.begin();
  PropertiesStoreT::const_iterator end = obj->second.end();
  for(;cur!=end;cur++){ lst.push_back(cur->second); }
  return StatusCode::SUCCESS;
}
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:
objNameObject name
propNameProperty name
property

Definition at line 50 of file Catalogue.cpp.

{
  ObjectsStoreT::const_iterator obj = m_properties.find(objName);
  if ( obj == m_properties.end()){ return StatusCode::FAILURE; }
  PropertiesStoreT::const_iterator prop = obj->second.find(propName);
  if ( prop==obj->second.end()){ return StatusCode::FAILURE; }
  property = prop->second;
  return StatusCode::SUCCESS;
}

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:55:28 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004