Gaudi::Parsers::Catalog Class Referencefinal

#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, PropertySetCatalogSet
 
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 (std::string client, 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 More...
 

Private Attributes

CatalogSet catalog_
 

Detailed Description

Definition at line 28 of file Catalog.h.

Member Typedef Documentation

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

Definition at line 31 of file Catalog.h.

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

Definition at line 35 of file Catalog.h.

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

Definition at line 34 of file Catalog.h.

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

Definition at line 30 of file Catalog.h.

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

Definition at line 33 of file Catalog.h.

Member Function Documentation

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

Definition at line 28 of file Catalog.cpp.

28  {
29  assert( property );
30  auto it = catalog_.find(property->ClientName());
31  if (it == catalog_.end()) {
32  CatalogSet::mapped_type properties;
33  properties.insert(property);
34  catalog_.emplace( property->ClientName(), properties );
35  return true;
36  }
37  it->second.erase(*property);
38  it->second.insert(property);
39  //TODO: check return value
40  return true;
41 }
Gaudi::Details::PropertyBase * property(const std::string &name) const
T end(T...args)
T find(T...args)
T emplace(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
template<typename Value >
bool Gaudi::Parsers::Catalog::Add ( std::string  client,
std::string  property,
const Value &  value 
)
inline

Definition at line 62 of file Catalog.h.

64  {
65  return Add(new Property(PropertyName(std::move(client), std::move(property)), PropertyValue(value)));
66 }
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:28
T move(T...args)
bool Add(Property *property)
Definition: Catalog.cpp:28
iterator Gaudi::Parsers::Catalog::begin ( )
inline

Definition at line 37 of file Catalog.h.

37 { return catalog_.begin();}
T begin(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
const_iterator Gaudi::Parsers::Catalog::begin ( ) const
inline

Definition at line 38 of file Catalog.h.

38 { return catalog_.begin();}
T begin(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
std::vector< std::string > Gaudi::Parsers::Catalog::ClientNames ( ) const

Definition at line 21 of file Catalog.cpp.

21  {
24  std::back_inserter(result), select1st );
25  return result;
26 }
T end(T...args)
T begin(T...args)
T back_inserter(T...args)
T transform(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
iterator Gaudi::Parsers::Catalog::end ( )
inline

Definition at line 39 of file Catalog.h.

39 { return catalog_.end();}
T end(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
const_iterator Gaudi::Parsers::Catalog::end ( ) const
inline

Definition at line 40 of file Catalog.h.

40 { return catalog_.end();}
T end(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
std::ostream & Gaudi::Parsers::Catalog::fillStream ( std::ostream out) const

print the content of the catalogue to std::ostream

Definition at line 66 of file Catalog.cpp.

67 {
68  o << "// " << std::string(82,'=') << std::endl
69  << "// Parser catalog " << std::endl
70  << "// " << std::string(82,'=') << std::endl ;
71 
72  size_t nComponents = 0 ;
73  size_t nProperties = 0 ;
74 
75  for (const auto& client : catalog_) {
76  o << boost::format("// Properties of '%1%' %|43t|# = %2%" )
77  % client.first % client.second.size() << std::endl ;
78  ++nComponents ;
79  nProperties += client.second.size() ;
80  for (const auto& current : client.second) {
81  o << boost::format("%1% %|44t| = %2% ; ")
82  % current.FullName()
83  % current.ValueAsString()
84  << '\n';
85  }
86  }
87  o << "// " << std::string(82,'=') << '\n'
88  << boost::format("// End parser catalog #Components=%1% #Properties=%2%")
89  % nComponents % nProperties << '\n'
90  << "// " << std::string(82,'=') << std::endl ;
91  return o ;
92 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
T endl(T...args)
STL class.
T size(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
gp::Property * Gaudi::Parsers::Catalog::Find ( const std::string client,
const std::string name 
)

Definition at line 43 of file Catalog.cpp.

44  {
45  auto it = catalog_.find(client);
46  if (it == catalog_.end()) return nullptr;
47 
48  auto pit = std::find_if(it->second.begin(), it->second.end(),
49  Property::Equal(name));
50  return (pit != it->second.end()) ? &*pit : nullptr;
51 
52 }
T end(T...args)
T find(T...args)
CatalogSet catalog_
Definition: Catalog.h:51
std::string Gaudi::Parsers::Catalog::ToString ( ) const

Definition at line 54 of file Catalog.cpp.

54  {
55  std::string result;
56  for (const auto& client : catalog_) {
57  for (const auto& current : client.second) {
58  result += current.ToString()+"\n";
59  }
60  }
61  return result;
62 }
STL class.
CatalogSet catalog_
Definition: Catalog.h:51

Member Data Documentation

CatalogSet Gaudi::Parsers::Catalog::catalog_
private

Definition at line 51 of file Catalog.h.


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