Gaudi Framework, version v21r6

Home   Generated: 11 Nov 2009

JobOptionsCatalogue Class Reference

#include <JobOptionsCatalogue.h>

Collaboration diagram for JobOptionsCatalogue:

Collaboration graph
[legend]

List of all members.


Detailed Description

Author:
Alexander MAZUROV Alexander.Mazurov@gmail.com

Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
2006-05-13

Definition at line 28 of file JobOptionsCatalogue.h.


Public Types

typedef std::vector< const
Property * > 
PropertiesT
typedef std::map< std::string,
PropertiesT
ObjectsT

Public Member Functions

 JobOptionsCatalogue ()
virtual ~JobOptionsCatalogue ()
StatusCode addProperty (const std::string &client, const Property *property)
StatusCode removeProperty (const std::string &client, const std::string &name)
const PropertiesTgetProperties (const std::string &client) const
std::vector< std::stringgetClients () const
std::ostreamfillStream (std::ostream &o) const
 dump the content of catalogue to std::ostream

Private Member Functions

PropertiesTfindProperties (const std::string &client) const
bool findProperty (PropertiesT *props, const std::string &name, PropertiesT::iterator &result)

Private Attributes

ObjectsTm_catalogue

Member Typedef Documentation

Definition at line 31 of file JobOptionsCatalogue.h.

Definition at line 32 of file JobOptionsCatalogue.h.


Constructor & Destructor Documentation

JobOptionsCatalogue::JobOptionsCatalogue (  ) 

Definition at line 21 of file JobOptionsCatalogue.cpp.

00022 { m_catalogue = new ObjectsT(); }

JobOptionsCatalogue::~JobOptionsCatalogue (  )  [virtual]

Definition at line 24 of file JobOptionsCatalogue.cpp.

00025 {
00026   for (ObjectsT::const_iterator cur=m_catalogue->begin();
00027        cur!=m_catalogue->end();cur++)
00028   {
00029     for(PropertiesT::const_iterator prop=cur->second.begin();
00030         prop!=cur->second.end(); prop++)
00031     { if(NULL != *prop){ delete *prop; } }
00032   }
00033   delete m_catalogue;
00034 }


Member Function Documentation

StatusCode JobOptionsCatalogue::addProperty ( const std::string client,
const Property property 
)

Definition at line 37 of file JobOptionsCatalogue.cpp.

00039 {
00040   PropertiesT*  props = findProperties(client);
00041   if ( props != 0 ){
00042     removeProperty(client,property->name()).ignore();
00043     props->push_back(property);
00044   }else{
00045     PropertiesT toInsert;
00046     toInsert.push_back(property);
00047     m_catalogue->insert(std::pair<std::string,PropertiesT>(client,toInsert));  
00048   }
00049   return StatusCode::SUCCESS;
00050 }

StatusCode JobOptionsCatalogue::removeProperty ( const std::string client,
const std::string name 
)

Definition at line 54 of file JobOptionsCatalogue.cpp.

00056 {
00057   PropertiesT*  props = findProperties(client);
00058   if (props)
00059   {
00060     PropertiesT::iterator toRemove;
00061     if(findProperty(props,name,toRemove))
00062     {
00063       delete *toRemove;
00064       props->erase(toRemove);
00065     }
00066   }
00067   return StatusCode::SUCCESS;
00068 }

const JobOptionsCatalogue::PropertiesT * JobOptionsCatalogue::getProperties ( const std::string client  )  const

Definition at line 72 of file JobOptionsCatalogue.cpp.

00072 { return findProperties(client); }

std::vector< std::string > JobOptionsCatalogue::getClients (  )  const

Definition at line 74 of file JobOptionsCatalogue.cpp.

00075 {
00076   std::vector<std::string> result;
00077   for (ObjectsT::const_iterator cur = m_catalogue->begin(); 
00078        cur != m_catalogue->end(); cur++) { result.push_back(cur->first); }
00079   return result;
00080 }

std::ostream & JobOptionsCatalogue::fillStream ( std::ostream o  )  const

dump the content of catalogue to std::ostream

Definition at line 102 of file JobOptionsCatalogue.cpp.

00103 {
00104   // loop over the clients:
00105   for ( ObjectsT::const_iterator iclient = m_catalogue->begin(); 
00106         m_catalogue->end() != iclient ; ++iclient ) 
00107   {
00108     const PropertiesT& props  = iclient->second ;
00109     o << "Client '" << iclient->first << "'" << std::endl ;
00110     for ( PropertiesT::const_iterator ip = props.begin() ; 
00111           props.end() != ip ; ++ip ) 
00112     {
00113       const Property* p = *ip ;
00114       if ( 0 == p ) { continue ; }                             // CONTINUE 
00115       o << "\t" << (*p) << std::endl ;
00116     } 
00117   }
00118   //
00119   return o ;                                                   // RETURN 
00120 }

JobOptionsCatalogue::PropertiesT * JobOptionsCatalogue::findProperties ( const std::string client  )  const [private]

Definition at line 83 of file JobOptionsCatalogue.cpp.

00084 {
00085   ObjectsT::iterator result;       
00086   if((result = m_catalogue->find(client))==m_catalogue->end()){ return 0; }
00087   return &result->second;
00088 }

bool JobOptionsCatalogue::findProperty ( JobOptionsCatalogue::PropertiesT props,
const std::string name,
PropertiesT::iterator result 
) [private]

Definition at line 91 of file JobOptionsCatalogue.cpp.

00094 {
00095   for(result = props->begin();result!=props->end();result++){
00096     if(boost::to_lower_copy((*result)->name()) == boost::to_lower_copy(name))
00097     { return true; }
00098   } 
00099   return false;
00100 }


Member Data Documentation

Definition at line 50 of file JobOptionsCatalogue.h.


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

Generated at Wed Nov 11 16:34:04 2009 for Gaudi Framework, version v21r6 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004