BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
McCnvSvc.cxx
Go to the documentation of this file.
1//====================================================================
2// McCnvSvc.cxx
3//--------------------------------------------------------------------
4//
5// Package : McEventSelector
6//
7
8// Include files
9#include "GaudiKernel/GenericAddress.h"
10#include "GaudiKernel/IConversionSvc.h"
11#include "GaudiKernel/IDataManagerSvc.h"
12#include "GaudiKernel/IDataProviderSvc.h"
13#include "GaudiKernel/ISvcLocator.h"
14#include "GaudiKernel/MsgStream.h"
15#include "GaudiKernel/RegistryEntry.h"
16#include "GaudiKernel/SmartIF.h"
17#include <iostream>
18
19#include "McAddress.h"
20#include "McCnvSvc.h"
21#include "McEventCnv.h"
22#include "McEventSelector.h"
23
24// External definitions
25
26// Instantiation of a static factory class used by clients to create
27// instances of this service
28// static SvcFactory<McCnvSvc> s_factory;
29// const ISvcFactory& McCnvSvcFactory = s_factory;
30
31/// Standard constructor
32
34
35McCnvSvc::McCnvSvc( const std::string& name, ISvcLocator* svc )
36 : ConversionSvc( name, svc, storageType() ) {}
37
38/// Standard Destructor
40
41/// Initialize the service.
43 info() << "McCnvSvc::initialize" << endmsg;
44 StatusCode status = ConversionSvc::initialize();
45 return status;
46}
47
48StatusCode McCnvSvc::finalize() {
49 MsgStream log( msgSvc(), name() );
50 log << MSG::DEBUG << "RootCnvSvc::finalize" << endmsg;
51
52 ConversionSvc::finalize().ignore();
53
54 return StatusCode::SUCCESS;
55}
56
57StatusCode McCnvSvc::queryInterface( const InterfaceID& riid, void** ppvInterface ) {
58 if ( IID_IMcCnvSvc == riid ) { *ppvInterface = (McCnvSvc*)this; }
59 else
60 {
61 // Interface is not directly availible: try out a base class
62 return ConversionSvc::queryInterface( riid, ppvInterface );
63 }
64 addRef();
65 return StatusCode::SUCCESS;
66}
67
68/// Update state of the service
69StatusCode McCnvSvc::updateServiceState( IOpaqueAddress* pAddress ) {
70 MsgStream log( msgSvc(), name() );
71 static bool first = true;
72 // static int fid = 0;
73 // static int recid = 0;
74 if ( 0 != pAddress )
75 {
76 GenericAddress* pAddr = dynamic_cast<GenericAddress*>( pAddress );
77 if ( 0 != pAddr )
78 {
79 if ( first ) { first = false; }
80 return StatusCode::SUCCESS;
81 }
82 }
83 return StatusCode::FAILURE;
84}
85
86unsigned char McCnvSvc::storageType() {
87 static unsigned char type = 0x10;
88 return type;
89}
90
91IConverter* McCnvSvc::createConverter( long typ, const CLID& wanted, const ICnvFactory* fac ) {
92 if ( wanted == 110 ) return new McEventCnv( serviceLocator().get() );
93 else return ConversionSvc::createConverter( typ, wanted, fac );
94}
DECLARE_COMPONENT(BesBdkRc)
IMessageSvc * msgSvc()
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
Definition McCnvSvc.cxx:69
static unsigned char storageType()
storage type
Definition McCnvSvc.cxx:86
virtual StatusCode initialize()
Initialize the service.
Definition McCnvSvc.cxx:42
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Override inherited queryInterface due to enhanced interface.
Definition McCnvSvc.cxx:57
virtual ~McCnvSvc()
Standard Destructor.
Definition McCnvSvc.cxx:39
virtual StatusCode finalize()
Definition McCnvSvc.cxx:48
McCnvSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition McCnvSvc.cxx:35
IConverter * createConverter(long typ, const CLID &wanted, const ICnvFactory *fac) override
Definition McCnvSvc.cxx:91