The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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::LessThenPropertySet
 
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::string > ClientNames () 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::ostream & fillStream (std::ostream &out) const
 print the content of the catalogue to std::ostream
 

Private Attributes

CatalogSet catalog_
 

Detailed Description

Definition at line 22 of file Catalog.h.

Member Typedef Documentation

◆ CatalogSet

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

Definition at line 25 of file Catalog.h.

◆ const_iterator

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

Definition at line 29 of file Catalog.h.

◆ iterator

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

Definition at line 28 of file Catalog.h.

◆ PropertySet

Definition at line 24 of file Catalog.h.

◆ value_type

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

Definition at line 27 of file Catalog.h.

Member Function Documentation

◆ Add() [1/2]

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

Definition at line 33 of file Catalog.cpp.

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

◆ Add() [2/2]

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

Definition at line 54 of file Catalog.h.

54 {
55 return Add( new Property( PropertyName( std::move( client ), std::move( property ) ), PropertyValue( value ) ) );
56}
bool Add(Property *property)
Definition Catalog.cpp:33

◆ begin() [1/2]

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

Definition at line 31 of file Catalog.h.

31{ return catalog_.begin(); }

◆ begin() [2/2]

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

Definition at line 32 of file Catalog.h.

32{ return catalog_.begin(); }

◆ ClientNames()

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

Definition at line 28 of file Catalog.cpp.

28 {
29 std::vector<std::string> result;
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 33 of file Catalog.h.

33{ return catalog_.end(); }

◆ end() [2/2]

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

Definition at line 34 of file Catalog.h.

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

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

◆ Find()

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

Definition at line 47 of file Catalog.cpp.

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

◆ ToString()

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

Definition at line 56 of file Catalog.cpp.

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

Member Data Documentation

◆ catalog_

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

Definition at line 46 of file Catalog.h.


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