All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::Parsers::Catalog Class Reference

#include <src/JobOptionsSvc/Catalog.h>

Collaboration diagram for Gaudi::Parsers::Catalog:

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::string > ClientNames () 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::ostream & fillStream (std::ostream &out) const
 print the content of the catalogue to std::ostream More...
 

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.

21  {
22  assert( property != NULL);
23  CatalogSet::iterator it = catalog_.find(property->ClientName());
24  if (it == catalog_.end()) {
25  CatalogSet::mapped_type properties;
26  properties.insert(property);
27  catalog_.insert(CatalogSet::value_type(property->ClientName(), properties));
28  return true;
29  }
30  it->second.erase(*property);
31  it->second.insert(property);
32  //TODO: check return value
33  return true;
34 }
CatalogSet catalog_
Definition: Catalog.h:52
template<typename Value >
bool Gaudi::Parsers::Catalog::Add ( const std::string &  client,
const std::string &  property,
const Value &  value 
)
inline

Definition at line 63 of file Catalog.h.

65  {
66  return Add(new Property(PropertyName(client, property), PropertyValue(value)));
67 }
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
bool Add(Property *property)
Definition: Catalog.cpp:21
iterator Gaudi::Parsers::Catalog::begin ( )
inline

Definition at line 38 of file Catalog.h.

38 { return catalog_.begin();}
CatalogSet catalog_
Definition: Catalog.h:52
const_iterator Gaudi::Parsers::Catalog::begin ( ) const
inline

Definition at line 39 of file Catalog.h.

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

Definition at line 13 of file Catalog.cpp.

13  {
14  std::vector<std::string> result;
15  BOOST_FOREACH(const CatalogSet::value_type& prop, catalog_) {
16  result.push_back(prop.first);
17  }
18  return result;
19 }
CatalogSet catalog_
Definition: Catalog.h:52
iterator Gaudi::Parsers::Catalog::end ( )
inline

Definition at line 40 of file Catalog.h.

40 { return catalog_.end();}
CatalogSet catalog_
Definition: Catalog.h:52
const_iterator Gaudi::Parsers::Catalog::end ( ) const
inline

Definition at line 41 of file Catalog.h.

41 { return catalog_.end();}
CatalogSet catalog_
Definition: Catalog.h:52
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.

62 {
63  o << "// " << std::string(82,'=') << std::endl
64  << "// Parser catalog " << std::endl
65  << "// " << std::string(82,'=') << std::endl ;
66 
67  size_t nComponents = 0 ;
68  size_t nProperties = 0 ;
69 
70  BOOST_FOREACH(const CatalogSet::value_type& client, catalog_) {
71  o << boost::format("// Properties of '%1%' %|43t|# = %2%" )
72  % client.first % client.second.size() << std::endl ;
73  ++nComponents ;
74  nProperties += client.second.size() ;
75  for (CatalogSet::mapped_type::const_iterator current = client.second.begin();
76  current != client.second.end(); ++current) {
77  o << boost::format("%1% %|44t| = %2% ; ")
78  % current->FullName()
79  % current->ValueAsString()
80  << std::endl;
81  }
82  }
83  o << "// " << std::string(82,'=') << std::endl
84  << boost::format("// End parser catalog #Components=%1% #Properties=%2%")
85  % nComponents % nProperties << std::endl
86  << "// " << std::string(82,'=') << std::endl ;
87  return o ;
88 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:133
CatalogSet catalog_
Definition: Catalog.h:52
gp::Property * Gaudi::Parsers::Catalog::Find ( const std::string &  client,
const std::string &  name 
)

Definition at line 36 of file Catalog.cpp.

37  {
38  CatalogSet::iterator it = catalog_.find(client);
39  if (it == catalog_.end()) return NULL;
40 
41  CatalogSet::mapped_type::iterator pit = std::find_if(it->second.begin(),
42  it->second.end(), Property::Equal(name));
43  if (pit == it->second.end()) return NULL;
44  return &*pit;
45 
46 }
CatalogSet catalog_
Definition: Catalog.h:52
std::string Gaudi::Parsers::Catalog::ToString ( ) const

Definition at line 48 of file Catalog.cpp.

48  {
49  std::string result;
50  BOOST_FOREACH(const CatalogSet::value_type& client, catalog_) {
51  for (CatalogSet::mapped_type::const_iterator current = client.second.begin();
52  current != client.second.end(); ++current) {
53  result += current->ToString()+"\n";
54  }
55  }
56  return result;
57 }
CatalogSet catalog_
Definition: Catalog.h:52

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: