Commit 0d7c28a5 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Removed FastContainerSvc.

IN PROGRESS - issue GAUDI-1: Split GaudiSvc in smaller libraries 
https://sftjira.cern.ch/browse/GAUDI-1

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/branches/GAUDI/GAUDI_newpack@6725 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent a7a3d91f
......@@ -27,7 +27,6 @@
#include "GaudiKernel/StatEntity.h"
#include "GaudiKernel/ICounterSummarySvc.h"
#include "GaudiKernel/IUpdateManagerSvc.h"
#include "GaudiKernel/TransientFastContainer.h"
#include "GaudiKernel/HashMap.h"
// ============================================================================
// forward declarations
......@@ -98,9 +97,9 @@ protected: // few actual data types
/// a pointer to the CounterSummarySvc
ICounterSummarySvc* m_counterSummarySvc;
///list of counters to declare. Set by property CounterList. This can be a regular expression.
std::vector<std::string> m_counterList;
std::vector<std::string> m_counterList;
//list of stat entities to write. Set by property StatEntityList. This can be a regular expression.
std::vector<std::string> m_statEntityList;
std::vector<std::string> m_statEntityList;
public:
// ==========================================================================
/** @brief Templated access to the data in Gaudi Transient Store
......@@ -315,8 +314,6 @@ public:
const bool create = true ) const ;
/// Short-cut to locate the Update Manager Service.
inline IUpdateManagerSvc * updMgrSvc() const;
/// Short-cut to locate the Fast Containers Service.
inline IDataProviderSvc * fastContainersSvc() const;
public:
/** Print the error message and return with the given StatusCode.
*
......@@ -661,13 +658,6 @@ public:
* @endcode
*/
inline StatusCode runUpdate() { return updMgrSvc()->update(this); }
/// Return a new TransientFastContainer for objects of type T.
/// The container is created if it is not in the transient store.
/// If a container with the same name but a different type
template <class T>
TransientFastContainer<T> * getFastContainer
( const std::string &location,
typename TransientFastContainer<T>::size_type initial=0);
public:
/// Algorithm constructor
GaudiCommon ( const std::string & name,
......@@ -736,18 +726,18 @@ public:
// ==========================================================================
public:
// ==========================================================================
/// get the list of aquired tools
const AlgTools& tools () const { return m_tools ; } // get all tools
/// get the list of aquired services
const Services& services () const { return m_services ; } // get all services
/// get the list of aquired tools
const AlgTools& tools () const { return m_tools ; } // get all tools
/// get the list of aquired services
const Services& services () const { return m_services ; } // get all services
// ==========================================================================
private:
// ==========================================================================
/// handler for "ErrorPrint" property
/// handler for "ErrorPrint" property
void printErrorHandler ( Property& /* theProp */ ) ; // "ErrorPrint"
/// handler for "PropertiesPrint" property
/// handler for "PropertiesPrint" property
void printPropsHandler ( Property& /* theProp */ ) ; // "PropertiesPrint"
/// handler for "StatPrint" property
/// handler for "StatPrint" property
void printStatHandler ( Property& /* theProp */ ) ; // "StatPrint"
// ==========================================================================
public:
......@@ -794,8 +784,6 @@ private:
// ==========================================================================
/// Pointer to the Update Manager Service instance
mutable IUpdateManagerSvc* m_updMgrSvc;
/// Pointer to the service providing transient fast containers
mutable IDataProviderSvc* m_fastContainersSvc;
// ==========================================================================
/// insert the actual C++ type of the algorithm in the messages?
bool m_typePrint ;
......
......@@ -202,50 +202,6 @@ GaudiCommon<PBASE>::updMgrSvc() const
return m_updMgrSvc ;
}
// ============================================================================
// Short-cut to get a pointer to the
// ============================================================================
template <class PBASE>
inline IDataProviderSvc *
GaudiCommon<PBASE>::fastContainersSvc() const
{
if ( !m_fastContainersSvc )
{ m_fastContainersSvc = svc<IDataProviderSvc>("FastContainersSvc",true); }
return m_fastContainersSvc ;
}
// ============================================================================
// Get a fast container
// ============================================================================
template < class PBASE >
template < class T >
inline TransientFastContainer<T> *
GaudiCommon<PBASE>::getFastContainer( const std::string &location,
typename TransientFastContainer<T>::size_type initial )
{
typedef TransientFastContainer<T> container_type;
IDataProviderSvc* svc = fastContainersSvc();
Assert( 0 != svc , "getFastContainer(): cannot get FastContainersSvc" );
container_type *ptr = NULL;
SmartDataPtr<container_type> obj( svc, location );
if (!obj){
ptr = new container_type(initial);
StatusCode status = svc->registerObject(location,ptr);
if ( !status.isSuccess() ){
Exception("getFastContainer(): cannot register '" +
System::typeinfoName( typeid( *ptr ) ) +
"' at address '" + location + "'" , status );
}
} else {
ptr = obj;
if ( !ptr ){
Exception("getFastContainer(): No valid container at '" + location + "'");
}
}
return ptr;
}
// ============================================================================
// predefined configurable message stream for the effective printouts
// ============================================================================
template <class PBASE>
......@@ -307,6 +263,6 @@ inline void GaudiCommon<PBASE>::Assert( const bool ok ,
std::string ( __FILE__ ) + "']" , code ) )
// ============================================================================
// The END
// The END
// ============================================================================
#endif // GAUDIALG_GAUDICOMMONIMP_H
Package: GaudiAlg
Package manager : Marco Clemencic
! 2011-12-05 - Marco Clemencic
- Removed the unused FastContainerSvc.
! 2011-12-01 - Chris Jones
- Fixed bug #85377: GaudiTuple tuple does not undestand ulonglong
Update TupleObj to properly support different data types.
Update TupleObj to properly support different data types.
=============================== GaudiAlg v13r8 ===============================
! 2011-08-08 - Marco Clemencic
......
......@@ -66,7 +66,6 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
m_msgLevel = MSG::NIL;
m_msgStream = 0;
m_updMgrSvc = 0;
m_fastContainersSvc = 0;
m_typePrint = true;
m_propsPrint = false;
m_statPrint = true;
......@@ -92,26 +91,26 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
// job options
// print error counters at finalization ?
this->declareProperty
( "ErrorsPrint" , m_errorsPrint ,
"Print the statistics of errors/warnings/exceptions")
this->declareProperty
( "ErrorsPrint" , m_errorsPrint ,
"Print the statistics of errors/warnings/exceptions")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printErrorHandler, this ) ;
// print properties at initialization?
this->declareProperty
this->declareProperty
( "PropertiesPrint" , m_propsPrint ,
"Print the properties of the component ")
"Print the properties of the component ")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printPropsHandler, this ) ;
// print statistical counters at finalization ?
this->declareProperty
( "StatPrint" , m_statPrint ,
"Print the table of counters" )
this->declareProperty
( "StatPrint" , m_statPrint ,
"Print the table of counters" )
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printStatHandler, this ) ;
( &GaudiCommon<PBASE>::printStatHandler, this ) ;
// insert the actual C++ type of the algorithm or tool in the messages?
this->declareProperty
( "TypePrint" , m_typePrint ,
this->declareProperty
( "TypePrint" , m_typePrint ,
"Add the actal C++ component type into the messages" ) ;
// context
this->declareProperty ( "Context" , m_context ) ;
......@@ -139,7 +138,7 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
this->declareProperty
( "UseEfficiencyRowFormat" , m_useEffFormat ,
"Use the special format for printout of efficiency counters" ) ;
//declare the list of simple counters to write.
this->declareProperty(
......@@ -151,7 +150,7 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
"StatEntityList",
m_statEntityList=std::vector<std::string>(0),
"RegEx list, of StatEntity counters for CounterSummary.");
// add handler for message level changes
this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
......@@ -247,12 +246,12 @@ StatusCode GaudiCommon<PBASE>::
// Check rootInTES ends with a /
if ( !m_rootInTES.empty() &&
m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
//Set up the CounterSummarySvc May need to be changed
this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ;
if (msgLevel(MSG::DEBUG))
{
if (m_counterSummarySvc==NULL )
if (m_counterSummarySvc==NULL )
debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
else debug() << "found CounterSummarySvc OK" << endmsg;
}
......@@ -325,14 +324,14 @@ StatusCode GaudiCommon<PBASE>::
debug() << endmsg;
}
while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; }
//release the CounterSummarySvc manually
if(m_counterSummarySvc)
if(m_counterSummarySvc)
{
m_counterSummarySvc->release();
m_counterSummarySvc=NULL;
}
// format printout
if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
{
......@@ -798,7 +797,7 @@ DataObject* GaudiCommon<PBASE>::put ( IDataProviderSvc* svc ,
template < class PBASE >
void GaudiCommon<PBASE>::printErrorHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> errorsPrint() ) { this -> printErrors () ; }
}
......@@ -808,7 +807,7 @@ void GaudiCommon<PBASE>::printErrorHandler ( Property& /* theProp */ )
template < class PBASE >
void GaudiCommon<PBASE>::printPropsHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; }
}
......@@ -818,7 +817,7 @@ void GaudiCommon<PBASE>::printPropsHandler ( Property& /* theProp */ )
template < class PBASE >
void GaudiCommon<PBASE>::printStatHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; }
}
......@@ -826,7 +825,7 @@ void GaudiCommon<PBASE>::printStatHandler ( Property& /* theProp */ )
// ============================================================================
// The END
// The END
// ============================================================================
......@@ -40,7 +40,6 @@ library GaudiExamples -import=Reflex -no_static \
THist/*.cpp \
ErrorLog/ErrorLogTest.cpp \
EvtColsEx/EvtColAlg.cpp \
FastContainers/*.cpp \
Maps/*.cpp \
MultipleLogStreams/*.cpp \
GaudiCommonTests/*.cpp \
......
Package GaudiExamples
Package manager : Marco Clemencic
! 2011-12-05 - Marco Clemencic
- Removed the unused FastContainerSvc.
! 2011-12-02 - Marco Clemencic
- Removed DataListenerSvc test.
......
This diff is collapsed.
// $Id: FastContainers.opts,v 1.3 2007/05/07 15:56:50 hmd Exp $
//--------------------------------------------------------------
// Component libraries
//--------------------------------------------------------------
//--------------------------------------------------------------
// Algorithms
//--------------------------------------------------------------
ApplicationMgr.TopAlg = { "GaudiSequencer" };
GaudiSequencer.Members = { "FastContainerProducer" };
GaudiSequencer.Members += { "FastContainerConsumer" };
GaudiSequencer.MeasureTime = true;
//--------------------------------------------------------------
// Input events
//--------------------------------------------------------------
// Input file
ApplicationMgr.EvtSel = "NONE";
// Number of events to be processed (default is 10)
ApplicationMgr.EvtMax = 10;
//--------------------------------------------------------------
// Message service options
//--------------------------------------------------------------
// Set output level threshold
// Levels: 1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL
MessageSvc.OutputLevel = 1;
// $Id: FastContainerConsumer.cpp,v 1.2 2006/11/29 18:47:33 hmd Exp $
// Include files
// from Gaudi
#include "GaudiKernel/DeclareFactoryEntries.h"
// local
#include "FastContainerConsumer.h"
//-----------------------------------------------------------------------------
// Implementation file for class : FastContainerConsumer
//
// 2006-05-03 : Marco Clemencic
//-----------------------------------------------------------------------------
// Declaration of the Algorithm Factory
DECLARE_ALGORITHM_FACTORY( FastContainerConsumer )
//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
FastContainerConsumer::FastContainerConsumer( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiAlgorithm ( name , pSvcLocator ),
m_container(NULL)
{
declareProperty("Container", m_containerLocation = "MyContainer");
}
//=============================================================================
// Destructor
//=============================================================================
FastContainerConsumer::~FastContainerConsumer() {}
//=============================================================================
// Initialization
//=============================================================================
StatusCode FastContainerConsumer::initialize() {
StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
debug() << "==> Initialize" << endmsg;
m_container = getFastContainer<internal_type>(m_containerLocation);
return StatusCode::SUCCESS;
}
//=============================================================================
// Main execution
//=============================================================================
StatusCode FastContainerConsumer::execute() {
debug() << "==> Execute" << endmsg;
debug() << "container size = " << m_container->size() << endmsg;
if ( m_container->size() != 3 ){
throw GaudiException("the size of the container should be 3",
"FastContainerConsumer::execute",
StatusCode::FAILURE);
}
container_type::iterator i = m_container->begin();
info() << "event " << **(i++) << endmsg;
info() << " " << **(i++) << endmsg;
info() << " " << **(i) << endmsg;
return StatusCode::SUCCESS;
}
//=============================================================================
// Finalize
//=============================================================================
StatusCode FastContainerConsumer::finalize() {
debug() << "==> Finalize" << endmsg;
return GaudiAlgorithm::finalize(); // must be called after all other actions
}
//=============================================================================
// $Id: FastContainerConsumer.h,v 1.2 2006/11/29 18:47:33 hmd Exp $
#ifndef FASTCONTAINERCONSUMER_H
#define FASTCONTAINERCONSUMER_H 1
// Include files
// from Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/TransientFastContainer.h"
#include "FastContainerProducer.h"
/** @class FastContainerConsumer FastContainerConsumer.h
*
*
* @author Marco Clemencic
* @date 2006-05-03
*/
class FastContainerConsumer : public GaudiAlgorithm {
public:
typedef FastContainerProducer::internal_type internal_type;
typedef FastContainerProducer::container_type container_type;
/// Standard constructor
FastContainerConsumer( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~FastContainerConsumer( ); ///< Destructor
virtual StatusCode initialize(); ///< Algorithm initialization
virtual StatusCode execute (); ///< Algorithm execution
virtual StatusCode finalize (); ///< Algorithm finalization
protected:
std::string m_containerLocation;
container_type *m_container;
};
#endif // FASTCONTAINERCONSUMER_H
// $Id: FastContainerProducer.cpp,v 1.2 2006/11/29 18:47:33 hmd Exp $
// Include files
// from Gaudi
#include "GaudiKernel/DeclareFactoryEntries.h"
// local
#include "FastContainerProducer.h"
//-----------------------------------------------------------------------------
// Implementation file for class : FastContainerProducer
//
// 2006-05-03 : Marco Clemencic
//-----------------------------------------------------------------------------
// Declaration of the Algorithm Factory
DECLARE_ALGORITHM_FACTORY( FastContainerProducer )
//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
FastContainerProducer::FastContainerProducer( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiAlgorithm ( name , pSvcLocator ),
m_container(NULL)
{
declareProperty("Container", m_containerLocation = "MyContainer");
}
//=============================================================================
// Destructor
//=============================================================================
FastContainerProducer::~FastContainerProducer() {}
//=============================================================================
// Initialization
//=============================================================================
StatusCode FastContainerProducer::initialize() {
StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
debug() << "==> Initialize" << endmsg;
m_container = getFastContainer<internal_type>(m_containerLocation,5);
return StatusCode::SUCCESS;
}
//=============================================================================
// Main execution
//=============================================================================
StatusCode FastContainerProducer::execute() {
static int evt = 0;
debug() << "==> Execute" << endmsg;
debug() << "container size = " << m_container->size() << endmsg;
// Create a new object with the default constructor.
internal_type *dbl = m_container->New();
*dbl = ++evt;
// Instantiate a new object using the copy constructor.
m_container->Add(2.5 * evt);
// Instantiate the new object with a custom constructor.
new(m_container->NewPointer()) internal_type(1.5 * evt);
return StatusCode::SUCCESS;
}
//=============================================================================
// Finalize
//=============================================================================
StatusCode FastContainerProducer::finalize() {
debug() << "==> Finalize" << endmsg;
return GaudiAlgorithm::finalize(); // must be called after all other actions
}
//=============================================================================
// $Id: FastContainerProducer.h,v 1.2 2006/11/29 18:47:34 hmd Exp $
#ifndef FASTCONTAINERPRODUCER_H
#define FASTCONTAINERPRODUCER_H 1
// Include files
// from Gaudi
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiKernel/TransientFastContainer.h"
/** @class FastContainerProducer FastContainerProducer.h
*
*
* @author Marco Clemencic
* @date 2006-05-03
*/
class FastContainerProducer : public GaudiAlgorithm {
public:
typedef double internal_type;
typedef TransientFastContainer<internal_type> container_type;
/// Standard constructor
FastContainerProducer( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~FastContainerProducer( ); ///< Destructor
virtual StatusCode initialize(); ///< Algorithm initialization
virtual StatusCode execute (); ///< Algorithm execution
virtual StatusCode finalize (); ///< Algorithm finalization
protected:
std::string m_containerLocation;
container_type *m_container;
};
#endif // FASTCONTAINERPRODUCER_H
......@@ -77,7 +77,7 @@ private:
TupleAlg() ;
// copy constructor is disabled
TupleAlg( const TupleAlg& ) ;
// assignement op[erator is disabled
// assignment operator is disabled
TupleAlg& operator=( const TupleAlg& ) ;
// Make a random generator for a type
template< class T >
......@@ -85,7 +85,7 @@ private:
{
const T min = std::numeric_limits<T>::min();
const T max = std::numeric_limits<T>::max();
return min + (T)( (max-min) *
return min + (T)( (max-min) *
(double)(Rndm::Numbers( randSvc(), Rndm::Flat(0,1) )()) );
}
......
<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="args"><set><text>$GAUDIEXAMPLESROOT/options/FastContainers.opts</text></set></argument>
<argument name="reference"><text>../../home/FastContainers.ref</text></argument>
</extension>
// $Id: TransientFastContainer.h,v 1.6 2008/10/27 16:41:33 marcocle Exp $
#ifndef GAUDIKERNEL_TRANSIENTFASTCONTAINER_H
#define GAUDIKERNEL_TRANSIENTFASTCONTAINER_H 1