The Gaudi Framework  v36r1 (3e2fb5a8)
Gaudi::Parsers::Catalog Class Referencefinal

#include </builds/gaudi/Gaudi/GaudiCoreSvc/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, std::less<> > 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 (std::string client, std::string property, const Value &value)
 
PropertyFind (std::string_view client, std::string_view 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

◆ 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 34 of file Catalog.cpp.

34  {
35  assert( property );
36  auto it = catalog_.find( property->ClientName() );
37  if ( it == catalog_.end() ) {
38  CatalogSet::mapped_type properties;
39  properties.insert( property );
40  catalog_.emplace( property->ClientName(), properties );
41  return true;
42  }
43  it->second.erase( *property );
44  it->second.insert( property );
45  // TODO: check return value
46  return true;
47 }

◆ 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 }

◆ begin() [1/2]

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

Definition at line 48 of file Catalog.h.

48 { return catalog_.begin(); }

◆ begin() [2/2]

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

Definition at line 49 of file Catalog.h.

49 { return catalog_.begin(); }

◆ ClientNames()

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

Definition at line 28 of file Catalog.cpp.

28  {
30  std::transform( std::begin( catalog_ ), std::end( catalog_ ), std::back_inserter( result ), select1st );
31  return result;
32 }

◆ end() [1/2]

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

Definition at line 50 of file Catalog.h.

50 { return catalog_.end(); }

◆ end() [2/2]

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

Definition at line 51 of file Catalog.h.

51 { return catalog_.end(); }

◆ fillStream()

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

print the content of the catalogue to std::ostream

Definition at line 69 of file Catalog.cpp.

69  {
70  o << R"(// ==================================================================================
71 // Parser catalog
72 // ==================================================================================
73 )";
74 
75  size_t nComponents = 0;
76  size_t nProperties = 0;
77 
78  for ( const auto& client : catalog_ ) {
79  o << fmt::format( "// Properties of {:<25} # = {}", fmt::format( "'{}'", client.first ), client.second.size() );
80  ++nComponents;
81  nProperties += client.second.size();
82  for ( const auto& current : client.second ) {
83  o << fmt::format( "{:<44} = {} ;", current.FullName(), current.ValueAsString() );
84  }
85  }
86  o << fmt::format( R"(// ==================================================================================
87 // End parser catalog #Components={1} #Properties={2}
88 // ==================================================================================
89 )",

◆ Find()

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

Definition at line 49 of file Catalog.cpp.

49  {
50  auto it = catalog_.find( client );
51  if ( it == catalog_.end() ) return nullptr;
52 
53  auto pit = std::find_if( it->second.begin(), it->second.end(),
54  [&]( const Property& property ) { return name == property.NameInClient(); } );
55 
56  return ( pit != it->second.end() ) ? &*pit : nullptr;
57 }

◆ ToString()

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

Definition at line 59 of file Catalog.cpp.

59  {
60  std::string result;
61  for ( const auto& client : catalog_ ) {
62  for ( const auto& current : client.second ) { result += current.ToString() + "\n"; }
63  }
64  return result;
65 }

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:
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
std::string
STL class.
std::move
T move(T... args)
Property
Gaudi::Details::PropertyBase Property
\fixme backward compatibility hack for old Property base class
Definition: Property.h:28
std::vector< std::string >
std::map::find
T find(T... args)
std::string::size
T size(T... args)
std::back_inserter
T back_inserter(T... args)
Gaudi::Parsers::Catalog::Add
bool Add(Property *property)
Definition: Catalog.cpp:34
std::map::emplace
T emplace(T... args)
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
std::transform
T transform(T... args)
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:62
std::map::begin
T begin(T... args)
std::map::end
T end(T... args)
Gaudi::Parsers::Catalog::catalog_
CatalogSet catalog_
Definition: Catalog.h:63