Gaudi Framework, version v23r2p1

Home   Generated: Fri Jun 29 2012
Public Types | Public Member Functions | Private Attributes

Gaudi::Parsers::Catalog Class Reference

#include <Catalog.h>

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

List of all members.

Public Types

typedef boost::ptr_set
< Property, Property::LessThen
PropertySet
typedef std::map< std::string,
PropertySet
CatalogSet
typedef CatalogSet::value_type value_type
typedef CatalogSet::iterator iterator
typedef CatalogSet::const_iterator const_iterator

Public Member Functions

iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
std::vector< std::stringClientNames () const
bool Add (Property *property)
template<typename Value >
bool Add (const std::string &client, const std::string &property, const Value &value)
PropertyFind (const std::string &client, const std::string &name)
std::string ToString () const
std::ostreamfillStream (std::ostream &out) const
 print the content of the catalogue to std::ostream

Private Attributes

CatalogSet catalog_

Detailed Description

Definition at line 29 of file Catalog.h.


Member Typedef Documentation

typedef std::map<std::string, PropertySet> Gaudi::Parsers::Catalog::CatalogSet

Definition at line 32 of file Catalog.h.

typedef CatalogSet::const_iterator Gaudi::Parsers::Catalog::const_iterator

Definition at line 36 of file Catalog.h.

typedef CatalogSet::iterator Gaudi::Parsers::Catalog::iterator

Definition at line 35 of file Catalog.h.

typedef boost::ptr_set<Property, Property::LessThen> Gaudi::Parsers::Catalog::PropertySet

Definition at line 31 of file Catalog.h.

typedef CatalogSet::value_type Gaudi::Parsers::Catalog::value_type

Definition at line 34 of file Catalog.h.


Member Function Documentation

bool Gaudi::Parsers::Catalog::Add ( Property property )

Definition at line 21 of file Catalog.cpp.

                                      {
  assert( property != NULL);
  CatalogSet::iterator it = catalog_.find(property->ClientName());
  if (it == catalog_.end()) {
    CatalogSet::mapped_type properties;
    properties.insert(property);
    catalog_.insert(CatalogSet::value_type(property->ClientName(), properties));
    return true;
  }
  it->second.erase(*property);
  it->second.insert(property);
  //TODO: check return value
  return true;
}
template<typename Value >
bool Gaudi::Parsers::Catalog::Add ( const std::string client,
const std::string property,
const Value &  value 
) [inline]

Definition at line 57 of file Catalog.h.

                            {
  return Add(new Property(PropertyName(client, property), PropertyValue(value)));
}
const_iterator Gaudi::Parsers::Catalog::begin ( void   ) const [inline]

Definition at line 39 of file Catalog.h.

{ return catalog_.begin();}
iterator Gaudi::Parsers::Catalog::begin ( void   ) [inline]

Definition at line 38 of file Catalog.h.

{ return catalog_.begin();}
std::vector< std::string > Gaudi::Parsers::Catalog::ClientNames (  ) const

Definition at line 13 of file Catalog.cpp.

                                                  {
    std::vector<std::string> result;
    BOOST_FOREACH(const CatalogSet::value_type& prop, catalog_) {
        result.push_back(prop.first);
    }
    return result;
}
const_iterator Gaudi::Parsers::Catalog::end ( void   ) const [inline]

Definition at line 41 of file Catalog.h.

{ return catalog_.end();}
iterator Gaudi::Parsers::Catalog::end ( void   ) [inline]

Definition at line 40 of file Catalog.h.

{ return catalog_.end();}
std::ostream & Gaudi::Parsers::Catalog::fillStream ( std::ostream out ) const

print the content of the catalogue to std::ostream

Definition at line 61 of file Catalog.cpp.

{
  o << "// " << std::string(82,'=') << std::endl
    << "//       Parser catalog " << std::endl
    << "// " << std::string(82,'=') << std::endl ;

  size_t nComponents = 0 ;
  size_t nProperties = 0 ;

  BOOST_FOREACH(const CatalogSet::value_type& client, catalog_)   {
    o << boost::format("// Properties of '%1%' %|43t|# = %2%" )
        % client.first % client.second.size() << std::endl ;
        ++nComponents ;
        nProperties += client.second.size() ;
   for (CatalogSet::mapped_type::const_iterator current = client.second.begin();
       current != client.second.end(); ++current) {
     o << boost::format("%1%   %|44t| = %2% ; ")
           % current->FullName()
           % current->ValueAsString()
       << std::endl;
   }
  }
  o << "// " << std::string(82,'=') << std::endl
      << boost::format("// End parser catalog #Components=%1% #Properties=%2%")
  % nComponents % nProperties     << std::endl
  << "// " << std::string(82,'=') << std::endl ;
  return o ;
}
gp::Property * Gaudi::Parsers::Catalog::Find ( const std::string client,
const std::string name 
)

Definition at line 36 of file Catalog.cpp.

                           {
  CatalogSet::iterator it = catalog_.find(client);
  if (it == catalog_.end()) return NULL;

  CatalogSet::mapped_type::iterator pit = std::find_if(it->second.begin(),
      it->second.end(), Property::Equal(name));
  if (pit == it->second.end()) return NULL;
  return &*pit;

}
std::string Gaudi::Parsers::Catalog::ToString (  ) const

Definition at line 48 of file Catalog.cpp.

                                    {
  std::string result;
  BOOST_FOREACH(const CatalogSet::value_type& client, catalog_) {
    for (CatalogSet::mapped_type::const_iterator current = client.second.begin();
        current != client.second.end(); ++current) {
      result += current->ToString()+"\n";
    }
  }
  return result;
}

Member Data Documentation

CatalogSet Gaudi::Parsers::Catalog::catalog_ [private]

Definition at line 52 of file Catalog.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 Fri Jun 29 2012 15:44:12 for Gaudi Framework, version v23r2p1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004