Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
JobOptionsSvc Class Reference

#include <JobOptionsSvc.h>

Inheritance diagram for JobOptionsSvc:
Inheritance graph
[legend]
Collaboration diagram for JobOptionsSvc:
Collaboration graph
[legend]

Public Types

typedef std::vector< const
Property * > 
PropertiesT
 
- Public Types inherited from extends2< Service, IProperty, IJobOptionsSvc >
typedef extends2 base_class
 Typedef to this class.
 
typedef extend_interfaces2
< IProperty, IJobOptionsSvc
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Public Types inherited from extend_interfaces2< I1, I2 >
typedef mpl::fold< typename
I1::iid::iids::type, typename
I2::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one.
 

Public Member Functions

 JobOptionsSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~JobOptionsSvc ()
 destructor
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 Service finalization method.
 
virtual StatusCode setMyProperties (const std::string &client, IProperty *me)
 Override default properties of the calling client.
 
virtual StatusCode addPropertyToCatalogue (const std::string &client, const Property &property)
 Add a property into the JobOptions catalog.
 
virtual StatusCode removePropertyFromCatalogue (const std::string &client, const std::string &name)
 Remove a property from the JobOptions catalog.
 
virtual const std::vector
< const Property * > * 
getProperties (const std::string &client) const
 Get the properties associated to a given client.
 
virtual std::vector< std::stringgetClients () const
 Get the list of clients.
 
virtual StatusCode readOptions (const std::string &file, const std::string &path="")
 look for file 'file' into search path 'path' and read it to update existing JobOptionsCatalogue
 
StatusCode setProperty (const Property &p)
 IProperty implementation (needed for initialisation)
 
StatusCode getProperty (Property *p) const
 
- Public Member Functions inherited from extends2< Service, IProperty, IJobOptionsSvc >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends2 (A1 a1)
 Templated constructor with 1 argument.
 
 extends2 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::stringgetInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends2 ()
 Virtual destructor.
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance.
 
virtual const std::stringname () const
 Retrieve name of the service.
 
virtual StatusCode configure ()
 
virtual StatusCode start ()
 
virtual StatusCode stop ()
 
virtual StatusCode terminate ()
 
virtual Gaudi::StateMachine::State FSMState () const
 
virtual Gaudi::StateMachine::State targetFSMState () const
 
virtual StatusCode reinitialize ()
 
virtual StatusCode restart ()
 
virtual StatusCode sysInitialize ()
 Initialize Service.
 
virtual StatusCode sysStart ()
 Initialize Service.
 
virtual StatusCode sysStop ()
 Initialize Service.
 
virtual StatusCode sysFinalize ()
 Finalize Service.
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service.
 
virtual StatusCode sysRestart ()
 Re-initialize the Service.
 
virtual StatusCode setProperty (const std::string &s)
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 
virtual const PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job.
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist.
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments.
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments.
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument.
 
 CommonMessaging ()
 Default constructor.
 
virtual ~CommonMessaging ()
 Virtual destructor.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual ~extend_interfaces2 ()
 Virtual destructor.
 

Private Member Functions

void fillServiceCatalog (const Gaudi::Parsers::Catalog &catalog)
 
void dump (const std::string &file, const Gaudi::Parsers::Catalog &catalog) const
 

Private Attributes

PropertyMgr m_pmgr
 dump the content of Properties catalog to the predefined file
 
std::string m_source_path
 
std::string m_source_type
 
std::string m_dir_search_path
 
std::string m_dump
 
SvcCatalog m_svc_catalog
 
bool m_dumped
 

Additional Inherited Members

- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor.
 
int outputLevel () const
 get the Service's output level
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level.
 
Gaudi::StateMachine::State m_state
 Service state.
 
Gaudi::StateMachine::State m_targetState
 Service state.
 

Detailed Description

Definition at line 21 of file JobOptionsSvc.h.

Member Typedef Documentation

Definition at line 23 of file JobOptionsSvc.h.

Constructor & Destructor Documentation

JobOptionsSvc::JobOptionsSvc ( const std::string name,
ISvcLocator svc 
)

Definition at line 31 of file JobOptionsSvc.cpp.

:
, m_dump()
, m_dumped( false )
{
tmp = System::getEnv ( "JOBOPTSEARCHPATH" ) ;
if ( !tmp.empty() && ("UNKNOWN" != tmp) ) { m_dir_search_path = tmp ; }
tmp = System::getEnv ( "JOBOPTSDUMPFILE" ) ;
if ( !tmp.empty() && ("UNKNOWN" != tmp) ) { m_dump = tmp ; }
m_pmgr.declareProperty( "DUMPFILE" , m_dump ) ;
}
virtual JobOptionsSvc::~JobOptionsSvc ( )
inlinevirtual

destructor

Definition at line 31 of file JobOptionsSvc.h.

{};

Member Function Documentation

StatusCode JobOptionsSvc::addPropertyToCatalogue ( const std::string client,
const Property property 
)
virtual

Add a property into the JobOptions catalog.

Definition at line 85 of file JobOptionsSvc.cpp.

{
Property* p = new StringProperty ( property.name(), "" ) ;
if ( !property.load( *p ) ) { delete p ; return StatusCode::FAILURE ; }
return m_svc_catalog.addProperty( client , p );
}
void JobOptionsSvc::dump ( const std::string file,
const Gaudi::Parsers::Catalog catalog 
) const
private

Definition at line 141 of file JobOptionsSvc.cpp.

{
MsgStream log ( msgSvc() , name() ) ;
// perform the actual dumping
if ( !out ) {
log << MSG::ERROR << "Unable to open dump-file \""+file+"\"" << endmsg ;
return ; // RETURN
}
else {
log << MSG::INFO << "Properties are dumped into \""+file+"\"" << endmsg ;
}
// perform the actual dump:
out << catalog;
}
void JobOptionsSvc::fillServiceCatalog ( const Gaudi::Parsers::Catalog catalog)
private

Definition at line 158 of file JobOptionsSvc.cpp.

{
BOOST_FOREACH(const gp::Catalog::value_type& client, catalog) {
for (gp::Catalog::CatalogSet::mapped_type::const_iterator current
= client.second.begin(); current != client.second.end();
++current) {
StringProperty tmp (current->NameInClient(), current->ValueAsString()) ;
addPropertyToCatalogue ( client.first , tmp ) ;
}
}
}
StatusCode JobOptionsSvc::finalize ( )
virtual

Service finalization method.

Reimplemented from Service.

Definition at line 78 of file JobOptionsSvc.cpp.

{
// finalize the base class
}
std::vector< std::string > JobOptionsSvc::getClients ( ) const
virtual

Get the list of clients.

Definition at line 136 of file JobOptionsSvc.cpp.

{
}
const JobOptionsSvc::PropertiesT * JobOptionsSvc::getProperties ( const std::string client) const
virtual

Get the properties associated to a given client.

Definition at line 102 of file JobOptionsSvc.cpp.

{
return m_svc_catalog.getProperties(client);
}
StatusCode JobOptionsSvc::getProperty ( Property p) const
virtual

Reimplemented from Service.

Definition at line 57 of file JobOptionsSvc.cpp.

{
return m_pmgr.getProperty( p );
}
StatusCode JobOptionsSvc::initialize ( )
virtual

Reimplemented from Service.

Definition at line 63 of file JobOptionsSvc.cpp.

{
// Call base class initializer
if( !sc.isSuccess() ) return sc;
// Read the job options if needed
if ( this->m_source_type == "NONE" ) {
}
else {
}
return sc;
}
StatusCode JobOptionsSvc::readOptions ( const std::string file,
const std::string path = "" 
)
virtual

look for file 'file' into search path 'path' and read it to update existing JobOptionsCatalogue

Parameters
filefile name
pathsearch path
Returns
status code

Definition at line 169 of file JobOptionsSvc.cpp.

{
std::string search_path = path;
if ( search_path.empty() && !m_dir_search_path.empty() )
{ search_path = m_dir_search_path ; }
//
MsgStream my_log( this->msgSvc(), this->name() );
my_log << MSG::DEBUG // debug
<< "Reading options from the file "
<< "'" << file << "'" << endmsg;
gp::Messages messages(my_log);
gp::Catalog catalog;
gp::Units units;
gp::PragmaOptions pragma;
gp::Node ast;
StatusCode sc = gp::ReadOptions(file, path, &messages, &catalog, &units,
&pragma, &ast);
// --------------------------------------------------------------------------
if ( sc.isSuccess() )
{
if (pragma.IsPrintOptions()) {
my_log << MSG::INFO << "Print options" << std::endl << catalog
<< endmsg;
}
if (pragma.IsPrintTree()) {
my_log << MSG::INFO << "Print tree:" << std::endl << ast.ToString()
<< endmsg;
}
if (pragma.HasDumpFile()) {
dump(pragma.dumpFile(), catalog);
}
my_log << MSG::INFO
<< "Job options successfully read in from " << file << endmsg;
}
else
{
my_log << MSG::FATAL << "Job options errors."<< endmsg;
}
// ----------------------------------------------------------------------------
return sc;
}
StatusCode JobOptionsSvc::removePropertyFromCatalogue ( const std::string client,
const std::string name 
)
virtual

Remove a property from the JobOptions catalog.

Definition at line 95 of file JobOptionsSvc.cpp.

{
}
StatusCode JobOptionsSvc::setMyProperties ( const std::string client,
IProperty me 
)
virtual

Override default properties of the calling client.

Parameters
clientName of the client algorithm or service
meAddress of the interface IProperty of the client

Definition at line 107 of file JobOptionsSvc.cpp.

{
const SvcCatalog::PropertiesT* props =
if ( NULL == props ){ return StatusCode::SUCCESS; }
bool fail = false;
cur != props->end(); cur++)
{
StatusCode sc = myInt->setProperty (**cur ) ;
if ( sc.isFailure() )
{
MsgStream my_log( this->msgSvc(), this->name() );
my_log
<< "Unable to set the property '" << (*cur)->name() << "'"
<< " of '" << client << "'. "
<< "Check option and algorithm names, type and bounds."
<< endmsg;
fail = true;
}
}
}
StatusCode JobOptionsSvc::setProperty ( const Property p)
virtual

IProperty implementation (needed for initialisation)

Reimplemented from Service.

Definition at line 52 of file JobOptionsSvc.cpp.

{
return m_pmgr.setProperty( p );
}

Member Data Documentation

std::string JobOptionsSvc::m_dir_search_path
private

Definition at line 79 of file JobOptionsSvc.h.

std::string JobOptionsSvc::m_dump
private

Definition at line 80 of file JobOptionsSvc.h.

bool JobOptionsSvc::m_dumped
private

Definition at line 82 of file JobOptionsSvc.h.

PropertyMgr JobOptionsSvc::m_pmgr
private

dump the content of Properties catalog to the predefined file

Definition at line 76 of file JobOptionsSvc.h.

std::string JobOptionsSvc::m_source_path
private

Definition at line 77 of file JobOptionsSvc.h.

std::string JobOptionsSvc::m_source_type
private

Definition at line 78 of file JobOptionsSvc.h.

SvcCatalog JobOptionsSvc::m_svc_catalog
private

Definition at line 81 of file JobOptionsSvc.h.


The documentation for this class was generated from the following files:
Generated at Wed Mar 20 2013 17:59:46 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004