The Gaudi Framework  v31r0 (aeb156f0)
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 30 of file SvcCatalog.cpp.

30  {
31  for ( const auto& cur : m_catalog ) {
32  for ( auto& prop : cur.second ) delete prop;
33  }
34 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47

Member Function Documentation

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

Definition at line 36 of file SvcCatalog.cpp.

36  {
37  auto props = findProperties( client );
38  if ( props ) {
39  removeProperty( client, property->name() ).ignore();
40  props->push_back( property );
41  } else {
42  m_catalog.emplace( client, PropertiesT{property} );
43  }
44  return StatusCode::SUCCESS;
45 }
std::vector< const Gaudi::Details::PropertyBase * > PropertiesT
Definition: SvcCatalog.h:27
const std::string name() const
property name
Definition: Property.h:36
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode removeProperty(const std::string &client, const std::string &name)
Definition: SvcCatalog.cpp:47
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:70
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47
std::ostream & SvcCatalog::fillStream ( std::ostream o) const

dump the content of catalog to std::ostream

Definition at line 96 of file SvcCatalog.cpp.

96  {
97  // loop over the clients:
98  for ( const auto& iclient : m_catalog ) {
99  o << "Client '" << iclient.first << "'" << std::endl;
100  for ( const auto& p : iclient.second ) {
101  if ( p ) o << "\t" << ( *p ) << std::endl;
102  }
103  }
104  //
105  return o; // RETURN
106 }
T endl(T...args)
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47
const SvcCatalog::PropertiesT * SvcCatalog::findProperties ( const std::string client) const
private

Definition at line 70 of file SvcCatalog.cpp.

70  {
71  auto result = m_catalog.find( client );
72  return ( result != m_catalog.end() ) ? &result->second : nullptr;
73 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47
SvcCatalog::PropertiesT * SvcCatalog::findProperties ( const std::string client)
private

Definition at line 75 of file SvcCatalog.cpp.

75  {
76  auto result = m_catalog.find( client );
77  return ( result != m_catalog.end() ) ? &result->second : nullptr;
78 }
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47
std::pair< bool, SvcCatalog::PropertiesT::const_iterator > SvcCatalog::findProperty ( const PropertiesT props,
const std::string name 
) const
private

Definition at line 80 of file SvcCatalog.cpp.

81  {
82  auto p = std::find_if( std::begin( props ), std::end( props ), [&]( const Gaudi::Details::PropertyBase* prop ) {
83  return boost::iequals( name, prop->name() );
84  } );
85  return {p != std::end( props ), p};
86 }
const std::string name() const
property name
Definition: Property.h:36
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 88 of file SvcCatalog.cpp.

89  {
90  auto p = std::find_if( std::begin( props ), std::end( props ), [&]( const Gaudi::Details::PropertyBase* prop ) {
91  return boost::iequals( name, prop->name() );
92  } );
93  return {p != std::end( props ), p};
94 }
const std::string name() const
property name
Definition: Property.h:36
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 63 of file SvcCatalog.cpp.

63  {
65  result.reserve( m_catalog.size() );
67  return result;
68 }
T end(T...args)
std::map< std::string, PropertiesT > m_catalog
Definition: SvcCatalog.h:47
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 59 of file SvcCatalog.cpp.

59  {
60  return findProperties( client );
61 }
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:70
const Gaudi::Details::PropertyBase * SvcCatalog::getProperty ( const std::string client,
const std::string name 
) const

Definition at line 107 of file SvcCatalog.cpp.

108  {
109  auto props = findProperties( client );
110  if ( props ) {
111  const auto res = findProperty( *props, name );
112  if ( res.first ) { return *res.second; }
113  }
114  return nullptr;
115 }
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:70
std::pair< bool, PropertiesT::const_iterator > findProperty(const PropertiesT &props, const std::string &name) const
Definition: SvcCatalog.cpp:80
StatusCode SvcCatalog::removeProperty ( const std::string client,
const std::string name 
)

Definition at line 47 of file SvcCatalog.cpp.

47  {
48  auto props = findProperties( client );
49  if ( props ) {
50  auto res = findProperty( *props, name );
51  if ( res.first ) {
52  delete *res.second;
53  props->erase( res.second );
54  }
55  }
56  return StatusCode::SUCCESS;
57 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const PropertiesT * findProperties(const std::string &client) const
Definition: SvcCatalog.cpp:70
std::pair< bool, PropertiesT::const_iterator > findProperty(const PropertiesT &props, const std::string &name) const
Definition: SvcCatalog.cpp:80

Member Data Documentation

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

Definition at line 47 of file SvcCatalog.h.


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