The Gaudi Framework  v33r0 (d5ea422b)
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 39 of file Catalog.h.

Member Typedef Documentation

◆ CatalogSet

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

Definition at line 42 of file Catalog.h.

◆ const_iterator

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

Definition at line 46 of file Catalog.h.

◆ iterator

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

Definition at line 45 of file Catalog.h.

◆ PropertySet

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

Definition at line 41 of file Catalog.h.

◆ value_type

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

Definition at line 44 of file Catalog.h.

Member Function Documentation

◆ Add() [1/2]

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

Definition at line 41 of file Catalog.cpp.

41  {
42  assert( property );
43  auto it = catalog_.find( property->ClientName() );
44  if ( it == catalog_.end() ) {
45  CatalogSet::mapped_type properties;
46  properties.insert( property );
47  catalog_.emplace( property->ClientName(), properties );
48  return true;
49  }
50  it->second.erase( *property );
51  it->second.insert( property );
52  // TODO: check return value
53  return true;
54 }
T end(T... args)
T find(T... args)
T emplace(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ Add() [2/2]

template<typename Value >
bool Gaudi::Parsers::Catalog::Add ( std::string  client,
std::string  property,
const Value &  value 
)
inline

Definition at line 74 of file Catalog.h.

74  {
75  return Add( new Property( PropertyName( std::move( client ), std::move( property ) ), PropertyValue( value ) ) );
76 }
Gaudi::Details::PropertyBase Property
\fixme backward compatibility hack for old Property base class
Definition: PropertyFwd.h:35
T move(T... args)
bool Add(Property *property)
Definition: Catalog.cpp:41

◆ begin() [1/2]

iterator Gaudi::Parsers::Catalog::begin ( )
inline

Definition at line 48 of file Catalog.h.

48 { return catalog_.begin(); }
T begin(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ begin() [2/2]

const_iterator Gaudi::Parsers::Catalog::begin ( ) const
inline

Definition at line 49 of file Catalog.h.

49 { return catalog_.begin(); }
T begin(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ ClientNames()

std::vector< std::string > Gaudi::Parsers::Catalog::ClientNames ( ) const

Definition at line 35 of file Catalog.cpp.

35  {
37  std::transform( std::begin( catalog_ ), std::end( catalog_ ), std::back_inserter( result ), select1st );
38  return result;
39 }
T end(T... args)
T begin(T... args)
T back_inserter(T... args)
T transform(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ end() [1/2]

iterator Gaudi::Parsers::Catalog::end ( )
inline

Definition at line 50 of file Catalog.h.

50 { return catalog_.end(); }
T end(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ end() [2/2]

const_iterator Gaudi::Parsers::Catalog::end ( ) const
inline

Definition at line 51 of file Catalog.h.

51 { return catalog_.end(); }
T end(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ fillStream()

std::ostream & Gaudi::Parsers::Catalog::fillStream ( std::ostream out) const

print the content of the catalogue to std::ostream

Definition at line 74 of file Catalog.cpp.

74  {
75  o << "// " << std::string( 82, '=' ) << std::endl
76  << "// Parser catalog " << std::endl
77  << "// " << std::string( 82, '=' ) << std::endl;
78 
79  size_t nComponents = 0;
80  size_t nProperties = 0;
81 
82  for ( const auto& client : catalog_ ) {
83  o << boost::format( "// Properties of '%1%' %|43t|# = %2%" ) % client.first % client.second.size() << std::endl;
84  ++nComponents;
85  nProperties += client.second.size();
86  for ( const auto& current : client.second ) {
87  o << boost::format( "%1% %|44t| = %2% ; " ) % current.FullName() % current.ValueAsString() << '\n';
88  }
89  }
90  o << "// " << std::string( 82, '=' ) << '\n'
91  << boost::format( "// End parser catalog #Components=%1% #Properties=%2%" ) % nComponents % nProperties << '\n'
92  << "// " << std::string( 82, '=' ) << std::endl;
93  return o;
94 }
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:63

◆ Find()

gp::Property * Gaudi::Parsers::Catalog::Find ( const std::string client,
const std::string name 
)

Definition at line 56 of file Catalog.cpp.

56  {
57  auto it = catalog_.find( client );
58  if ( it == catalog_.end() ) return nullptr;
59 
60  auto pit = std::find_if( it->second.begin(), it->second.end(), Property::Equal( name ) );
61  return ( pit != it->second.end() ) ? &*pit : nullptr;
62 }
T end(T... args)
T find(T... args)
CatalogSet catalog_
Definition: Catalog.h:63

◆ ToString()

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

Definition at line 64 of file Catalog.cpp.

64  {
65  std::string result;
66  for ( const auto& client : catalog_ ) {
67  for ( const auto& current : client.second ) { result += current.ToString() + "\n"; }
68  }
69  return result;
70 }
STL class.
CatalogSet catalog_
Definition: Catalog.h:63

Member Data Documentation

◆ catalog_

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

Definition at line 63 of file Catalog.h.


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