/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Private Types | Private Attributes
Gaudi::Parsers::Catalogue Class Reference

Catalogue of PropertyEntry. More...

#include <Catalogue.h>

List of all members.

Public Types

typedef std::map< std::string,
std::vector< PropertyEntry > > 
CatalogueT

Public Member Functions

bool findProperties (const std::string &objName, std::vector< PropertyEntry > &list, bool rm=false)
 Find properties of object by object name.
bool findProperty (const std::string &objName, const std::string &propName, PropertyEntry &property, bool rm=false)
 Find property in catalogue.
void addProperty (const std::string &objName, const PropertyEntry &property)
 Add property to catalogue.
bool 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
std::ostream & print (std::ostream &out) const

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 43 of file Catalogue.h.


Member Typedef Documentation

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

Definition at line 46 of file Catalogue.h.

Definition at line 90 of file Catalogue.h.

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

Definition at line 91 of file Catalogue.h.


Member Function Documentation

bool Gaudi::Parsers::Catalogue::findProperties ( const std::string &  objName,
std::vector< PropertyEntry > &  list,
bool  rm = false 
)

Find properties of object by object name.

Returns:
true if catalogue contains object properties
Parameters:
objNameObject name
listResult list

Definition at line 28 of file Catalogue.cc.

{
  ObjectsStoreT::iterator obj = 
    m_properties.find(objName);
  if ( obj == m_properties.end()){ return false; }
  PropertiesStoreT::const_iterator cur = obj->second.begin();
  PropertiesStoreT::const_iterator end = obj->second.end();
  for(;cur!=end;cur++){ lst.push_back(cur->second); }
  if ( rm ) m_properties.erase( obj );
  return true;
}
bool Gaudi::Parsers::Catalogue::findProperty ( const std::string &  objName,
const std::string &  propName,
PropertyEntry property,
bool  rm = false 
)

Find property in catalogue.

Returns:
true - if catalogue contains property
Parameters:
objNameObject name
propNameProperty name
property

Definition at line 51 of file Catalogue.cc.

{
  ObjectsStoreT::iterator obj = m_properties.find(objName);
  if ( obj == m_properties.end()){ return false; }
  PropertiesStoreT::iterator prop = obj->second.find(propName);
  if ( prop==obj->second.end()){ return false; }
  property = prop->second;
  if ( rm ) {
      obj->second.erase( prop );
      if ( obj->second.empty() ) m_properties.erase( obj );
  }
  return true;
}
void Gaudi::Parsers::Catalogue::addProperty ( const std::string &  objName,
const PropertyEntry property 
)

Add property to catalogue.

Parameters:
objNameName of object
propertyProperty

Definition at line 97 of file Catalogue.cc.

{
  PropertyEntry prop = property;
  prop.removeEnv();
  m_properties[objName][ property.name()] = prop;
}
bool 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 114 of file Catalogue.cc.

{
  bool ok;
  std::string stringResult;
  std::vector<std::string> vectorResult;
  ok = Gaudi::Parsers::Utils::parseValue(value,stringResult,vectorResult);
  if(!ok){
    return false;
  }
  bool isVector = (vectorResult.size()>0) || (stringResult=="{}");
  if(isVector){
    addProperty(objName,PropertyEntry(propName,vectorResult));
  }else{
     addProperty(objName,PropertyEntry(propName,stringResult));        
  }
  return true;
}
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 73 of file Catalogue.cc.

{
  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 143 of file Catalogue.cc.

{
  o << "// " << std::string(82,'=') << std::endl 
    << "//       Parser catalogue " << std::endl 
    << "// " << std::string(82,'=') << std::endl ;
  return print(o);
}
std::ostream & Gaudi::Parsers::Catalogue::print ( std::ostream &  out) const

Definition at line 151 of file Catalogue.cc.

{
  //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%  %|32t| = %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 ; 
}

Member Data Documentation

Definition at line 93 of file Catalogue.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:18 for LafKernel by doxygen 1.7.4