The Gaudi Framework master (9cc87df9)
Loading...
Searching...
No Matches
Gaudi::Parsers::Catalog Class Referencefinal

#include <Catalog.h>

Collaboration diagram for Gaudi::Parsers::Catalog:

Public Types

using PropertySet = boost::ptr_set<Property, Property::LessThen>
using CatalogSet = std::map<std::string, PropertySet, std::less<>>
using value_type = CatalogSet::value_type
using iterator = CatalogSet::iterator
using const_iterator = CatalogSet::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)
Property * Find (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

◆ const_iterator

using Gaudi::Parsers::Catalog::const_iterator = CatalogSet::const_iterator

Definition at line 29 of file Catalog.h.

◆ iterator

using Gaudi::Parsers::Catalog::iterator = CatalogSet::iterator

Definition at line 28 of file Catalog.h.

◆ PropertySet

Definition at line 24 of file Catalog.h.

◆ value_type

using Gaudi::Parsers::Catalog::value_type = CatalogSet::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}
const_iterator end() const noexcept
iterator find(const key_type &__x)
std::pair< iterator, bool > emplace(_Args &&... __args)
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}
constexpr _OI move(_II __first, _II __last, _OI __result)
bool Add(Property *property)
Definition Catalog.cpp:33
PropertyName(std::string property)
PropertyValue(Value value, bool is_reference=false)
Property()
Construct an anonymous property with default constructed value.
Definition Property.h:124

◆ begin() [1/2]

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

Definition at line 31 of file Catalog.h.

31{ return catalog_.begin(); }
const_iterator begin() const noexcept

◆ 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;
31 return result;
32}
constexpr _OutputIterator transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __unary_op)
constexpr back_insert_iterator< _Container > back_inserter(_Container &__x)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())

◆ 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 << std::format( "// Properties of {:<25} # = {}", std::format( "'{}'", client.first ), client.second.size() );
74 ++nComponents;
75 nProperties += client.second.size();
76 for ( const auto& current : client.second ) {
77 o << std::format( "{:<44} = {} ;", current.FullName(), current.ValueAsString() );
78 }
79 }
80 o << std::format( R"(// ==================================================================================

◆ 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}
constexpr _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)

◆ 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}
basic_string< char > string

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: