BOSS 7.1.2
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
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
34
35DECLARE_COMPONENT(McCnvSvc)
36
37McCnvSvc::McCnvSvc(const std::string& name, ISvcLocator* svc)
38: ConversionSvc( name, svc, storageType())
39{
40}
41
42/// Standard Destructor
45
46/// Initialize the service.
48 MsgStream log(msgSvc(), name());
49 StatusCode status = ConversionSvc::initialize();
50 return status;
51}
52
53StatusCode McCnvSvc::finalize() {
54 MsgStream log(msgSvc(), name());
55 log << MSG::DEBUG << "RootCnvSvc::finalize" << endreq;
56
57 ConversionSvc::finalize();
58
59 return StatusCode::SUCCESS;
60}
61
62StatusCode McCnvSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
63
64 if ( IID_IMcCnvSvc == riid ) {
65 *ppvInterface = (McCnvSvc*)this;
66 }
67 else {
68 // Interface is not directly availible: try out a base class
69 return ConversionSvc::queryInterface(riid, ppvInterface);
70 }
71 addRef();
72 return StatusCode::SUCCESS;
73}
74
75/// Update state of the service
76StatusCode McCnvSvc::updateServiceState(IOpaqueAddress* pAddress) {
77 MsgStream log(messageService(), name());
78 static bool first = true;
79 // static int fid = 0;
80 // static int recid = 0;
81 if ( 0 != pAddress ) {
82 GenericAddress* pAddr = dynamic_cast<GenericAddress*>(pAddress);
83 if ( 0 != pAddr ) {
84 if ( first ) {
85 first = false;
86 }
87 return StatusCode::SUCCESS;
88 }
89 }
90 return StatusCode::FAILURE;
91}
92
93unsigned char McCnvSvc::storageType() {
94 static unsigned char type=0x10;
95 return type;
96}
IMessageSvc * msgSvc()
virtual StatusCode updateServiceState(IOpaqueAddress *pAddress)
Update state of the service.
Definition McCnvSvc.cxx:76
static unsigned char storageType()
storage type
Definition McCnvSvc.cxx:93
virtual StatusCode initialize()
Initialize the service.
Definition McCnvSvc.cxx:47
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Override inherited queryInterface due to enhanced interface.
Definition McCnvSvc.cxx:62
virtual ~McCnvSvc()
Standard Destructor.
Definition McCnvSvc.cxx:43
virtual StatusCode finalize()
Definition McCnvSvc.cxx:53