The Gaudi Framework  v30r3 (a5ef0a68)
SvcCatalog Class Referencefinal

#include <src/JobOptionsSvc/SvcCatalog.h>

Collaboration diagram for SvcCatalog:

Public Types

typedef std::vector< const Gaudi::Details::PropertyBase * > PropertiesT
 

Public Member Functions

 SvcCatalog ()=default
 
 ~SvcCatalog ()
 
StatusCode addProperty (const std::string &client, const Gaudi::Details::PropertyBase *property)
 
StatusCode removeProperty (const std::string &client, const std::string &name)
 
const PropertiesTgetProperties (const std::string &client) const
 
std::vector< std::stringgetClients () const
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &client, const std::string &name) const
 
std::ostreamfillStream (std::ostream &o) const
 dump the content of catalog to std::ostream More...
 

Private Member Functions

const PropertiesTfindProperties (const std::string &client) const
 
PropertiesTfindProperties (const std::string &client)
 
std::pair< bool, PropertiesT::const_iterator > findProperty (const PropertiesT &props, const std::string &name) const
 
std::pair< bool, PropertiesT::iterator > findProperty (PropertiesT &props, const std::string &name)
 

Private Attributes

std::map< std::string, PropertiesTm_catalog
 

Detailed Description

Member Typedef Documentation

Constructor & Destructor Documentation

SvcCatalog::SvcCatalog ( )
default
SvcCatalog::~SvcCatalog ( )

Definition at line 33 of file SvcCatalog.cpp.

34 {
35  for ( const auto& cur : m_catalog ) {
36  for ( auto& prop : cur.second ) delete prop;
37  }
38 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48

Member Function Documentation

StatusCode SvcCatalog::addProperty ( const std::string client,
const Gaudi::Details::PropertyBase property 
)

Definition at line 40 of file SvcCatalog.cpp.

41 {
42  auto props = findProperties( client );
43  if ( props ) {
44  removeProperty( client, property->name() ).ignore();
45  props->push_back( property );
46  } else {
47  m_catalog.emplace( client, PropertiesT{property} );
48  }
49  return StatusCode::SUCCESS;
50 }
std::vector< const Gaudi::Details::PropertyBase * > PropertiesT
Definition: SvcCatalog.h:28
const std::string name() const
property name
Definition: Property.h:40
StatusCode removeProperty(const std::string &client, const std::string &name)
Definition: SvcCatalog.cpp:52
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:78
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
std::ostream & SvcCatalog::fillStream ( std::ostream o) const

dump the content of catalog to std::ostream

Definition at line 108 of file SvcCatalog.cpp.

109 {
110  // loop over the clients:
111  for ( const auto& iclient : m_catalog ) {
112  o << "Client '" << iclient.first << "'" << std::endl;
113  for ( const auto& p : iclient.second ) {
114  if ( p ) o << "\t" << ( *p ) << std::endl;
115  }
116  }
117  //
118  return o; // RETURN
119 }
T endl(T...args)
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48
const SvcCatalog::PropertiesT * SvcCatalog::findProperties ( const std::string client) const
private

Definition at line 78 of file SvcCatalog.cpp.

79 {
80  auto result = m_catalog.find( client );
81  return ( result != m_catalog.end() ) ? &result->second : nullptr;
82 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48
SvcCatalog::PropertiesT * SvcCatalog::findProperties ( const std::string client)
private

Definition at line 84 of file SvcCatalog.cpp.

85 {
86  auto result = m_catalog.find( client );
87  return ( result != m_catalog.end() ) ? &result->second : nullptr;
88 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48
std::pair< bool, SvcCatalog::PropertiesT::const_iterator > SvcCatalog::findProperty ( const PropertiesT props,
const std::string name 
) const
private

Definition at line 90 of file SvcCatalog.cpp.

92 {
93  auto p = std::find_if( std::begin( props ), std::end( props ), [&]( const Gaudi::Details::PropertyBase* prop ) {
94  return boost::iequals( name, prop->name() );
95  } );
96  return {p != std::end( props ), p};
97 }
const std::string name() const
property name
Definition: Property.h:40
T end(T...args)
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
T find_if(T...args)
T begin(T...args)
std::pair< bool, SvcCatalog::PropertiesT::iterator > SvcCatalog::findProperty ( SvcCatalog::PropertiesT props,
const std::string name 
)
private

Definition at line 99 of file SvcCatalog.cpp.

101 {
102  auto p = std::find_if( std::begin( props ), std::end( props ), [&]( const Gaudi::Details::PropertyBase* prop ) {
103  return boost::iequals( name, prop->name() );
104  } );
105  return {p != std::end( props ), p};
106 }
const std::string name() const
property name
Definition: Property.h:40
T end(T...args)
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
T find_if(T...args)
T begin(T...args)
std::vector< std::string > SvcCatalog::getClients ( ) const

Definition at line 70 of file SvcCatalog.cpp.

71 {
73  result.reserve( m_catalog.size() );
75  return result;
76 }
T end(T...args)
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:48
T begin(T...args)
T back_inserter(T...args)
T transform(T...args)
T reserve(T...args)
const SvcCatalog::PropertiesT * SvcCatalog::getProperties ( const std::string client) const

Definition at line 65 of file SvcCatalog.cpp.

66 {
67  return findProperties( client );
68 }
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:78
const Gaudi::Details::PropertyBase * SvcCatalog::getProperty ( const std::string client,
const std::string name 
) const

Definition at line 120 of file SvcCatalog.cpp.

121 {
122  auto props = findProperties( client );
123  if ( props ) {
124  const auto res = findProperty( *props, name );
125  if ( res.first ) {
126  return *res.second;
127  }
128  }
129  return nullptr;
130 }
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:78
std::pair< bool, PropertiesT::const_iterator > findProperty(const PropertiesT &props, const std::string &name) const
Definition: SvcCatalog.cpp:90
StatusCode SvcCatalog::removeProperty ( const std::string client,
const std::string name 
)

Definition at line 52 of file SvcCatalog.cpp.

53 {
54  auto props = findProperties( client );
55  if ( props ) {
56  auto res = findProperty( *props, name );
57  if ( res.first ) {
58  delete *res.second;
59  props->erase( res.second );
60  }
61  }
62  return StatusCode::SUCCESS;
63 }
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:78
std::pair< bool, PropertiesT::const_iterator > findProperty(const PropertiesT &props, const std::string &name) const
Definition: SvcCatalog.cpp:90
constexpr static const auto SUCCESS
Definition: StatusCode.h:87

Member Data Documentation

std::map<std::string, PropertiesT> SvcCatalog::m_catalog
private

Definition at line 48 of file SvcCatalog.h.


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