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