BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataCnvSvc Class Referenceabstract

#include <RawDataCnvSvc.h>

+ Inheritance diagram for RawDataCnvSvc:

Public Member Functions

virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode declareObject (const IRawDataCnvSvc::Leaf &leaf)
 Associates a path on TDS with a particular converter.
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 Override inherited queryInterface due to enhanced interface.
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 
virtual StatusCode createAddress (long storageType, const CLID &clid, const std::string &, IOpaqueAddress *&refpAddress)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode declareObject (const IRawDataCnvSvc::Leaf &leaf)
 Associates a path on TDS with a particular converter.
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 Override inherited queryInterface due to enhanced interface.
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 
virtual StatusCode createAddress (long storageType, const CLID &clid, const std::string &, IOpaqueAddress *&refpAddress)
 
virtual StatusCode declareObject (const Leaf &leaf)=0
 Declare target leaf.
 
virtual StatusCode declareObject (const Leaf &leaf)=0
 Declare target leaf.
 

Protected Member Functions

virtual StatusCode addConverters ()=0
 
StatusCode updateServiceState (IOpaqueAddress *pAddress)
 Update state of the service.
 
 RawDataCnvSvc (const std::string &name, ISvcLocator *svc, long storageTyp)
 
virtual ~RawDataCnvSvc ()
 
virtual StatusCode addConverters ()=0
 
StatusCode updateServiceState (IOpaqueAddress *pAddress)
 
 RawDataCnvSvc (const std::string &name, ISvcLocator *svc, long storageTyp)
 
virtual ~RawDataCnvSvc ()
 

Friends

class SvcFactory< RawDataCnvSvc >
 

Detailed Description

class RawDataCnvSvc Conversion Service which coordinates all of converters.

When a component requests an item not yet available on the TDS, the RawDataCnvSvc is called to find the appropriate converter to gain access to the data and put it on the TDS.

Based on GLAST's EfbCnvSvc

Definition at line 23 of file Event/RawDataCnvBase/RawDataCnvBase-01-00-03/RawDataCnvBase/RawDataCnvSvc.h.

Constructor & Destructor Documentation

◆ RawDataCnvSvc() [1/2]

RawDataCnvSvc::RawDataCnvSvc ( const std::string &  name,
ISvcLocator *  svc,
long  storageTyp 
)
protected

Definition at line 23 of file RawDataCnvSvc.cxx.

24: ConversionSvc(name, svc, storageType)
25{
26}

◆ ~RawDataCnvSvc() [1/2]

virtual RawDataCnvSvc::~RawDataCnvSvc ( )
inlineprotectedvirtual

◆ RawDataCnvSvc() [2/2]

RawDataCnvSvc::RawDataCnvSvc ( const std::string &  name,
ISvcLocator *  svc,
long  storageTyp 
)
protected

◆ ~RawDataCnvSvc() [2/2]

virtual RawDataCnvSvc::~RawDataCnvSvc ( )
inlineprotectedvirtual

Member Function Documentation

◆ addConverters() [1/2]

virtual StatusCode RawDataCnvSvc::addConverters ( )
protectedpure virtual

Implemented in PackedRawDataCnvSvc, and PackedRawDataCnvSvc.

Referenced by initialize().

◆ addConverters() [2/2]

virtual StatusCode RawDataCnvSvc::addConverters ( )
protectedpure virtual

◆ createAddress() [1/4]

StatusCode RawDataCnvSvc::createAddress ( long  storageType,
const CLID &  clid,
const std::string &  ,
IOpaqueAddress *&  refpAddress 
)
virtual

Definition at line 184 of file RawDataCnvSvc.cxx.

188{
189 return createAddress(storageType, clid, NULL, NULL, refpAddress);
190}
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)

◆ createAddress() [2/4]

virtual StatusCode RawDataCnvSvc::createAddress ( long  storageType,
const CLID &  clid,
const std::string &  ,
IOpaqueAddress *&  refpAddress 
)
virtual

◆ createAddress() [3/4]

StatusCode RawDataCnvSvc::createAddress ( long  svc_type,
const CLID &  clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

Definition at line 162 of file RawDataCnvSvc.cxx.

167{
168 MsgStream log( msgSvc(), name() );
169
170 if (storageType != repSvcType() ) {
171 log << MSG::ERROR << "bad storage type" << storageType << endreq;
172 return StatusCode::FAILURE;
173 }
174
175 refpAddress = new GenericAddress(storageType,
176 clid,
177 "",
178 "",
179 0);
180
181 return StatusCode::SUCCESS;
182}

Referenced by createAddress(), and updateServiceState().

◆ createAddress() [4/4]

virtual StatusCode RawDataCnvSvc::createAddress ( long  svc_type,
const CLID &  clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

◆ declareObject() [1/2]

StatusCode RawDataCnvSvc::declareObject ( const IRawDataCnvSvc::Leaf leaf)
virtual

Associates a path on TDS with a particular converter.

Implements IRawDataCnvSvc.

Definition at line 83 of file RawDataCnvSvc.cxx.

83 {
84 // Purpose and Method: Callback from each of the individual converters that allows
85 // association of TDS path and converter.
86 Leaf* ll = new Leaf(leaf);
87 std::pair<LeafMap::iterator, bool> p = m_leaves.insert(LeafMap::value_type( leaf.path, ll) );
88 if( p.second ) {
89 return StatusCode::SUCCESS;
90 }
91 delete ll;
92 return StatusCode::FAILURE;
93}

Referenced by PackedRawDataCnvSvc::addConverters().

◆ declareObject() [2/2]

virtual StatusCode RawDataCnvSvc::declareObject ( const IRawDataCnvSvc::Leaf leaf)
virtual

Associates a path on TDS with a particular converter.

Implements IRawDataCnvSvc.

◆ finalize() [1/2]

StatusCode RawDataCnvSvc::finalize ( )
virtual

Definition at line 74 of file RawDataCnvSvc.cxx.

74 {
75 StatusCode status = ConversionSvc::finalize();
76 for (LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ ) {
77 delete (*k).second;
78 }
79 m_leaves.erase(m_leaves.begin(), m_leaves.end());
80 return status;
81}

◆ finalize() [2/2]

virtual StatusCode RawDataCnvSvc::finalize ( )
virtual

◆ initialize() [1/2]

StatusCode RawDataCnvSvc::initialize ( )
virtual

Reimplemented in PackedRawDataCnvSvc, and PackedRawDataCnvSvc.

Definition at line 28 of file RawDataCnvSvc.cxx.

28 {
29 // Purpose and Method: Setup Converter Service.
30 // Associate RawDataCnvSvc with the EventDataSvc
31 // Associate the list of known converters with this RawDataCnvSvc.
32
33 MsgStream log(messageService(), name());
34
35 StatusCode iret;
36 StatusCode status = ConversionSvc::initialize();
37 if ( status.isSuccess() ) {
38
39 IDataProviderSvc *pIDP = 0;
40 // Set event data service
41 status = service("EventDataSvc", pIDP, true);
42 if ( status.isSuccess() ) {
43 status = setDataProvider ( pIDP );
44 }
45 else {
46 return status;
47 }
48
49 // Add converters to the service
50 status = addConverters();
51 if ( !status.isSuccess() ) {
52 log << MSG::ERROR << "Unable to add converters to the service" << endreq;
53 return status;
54 }
55
56 // Now we have to configure the map of leaves
57 // Which should contain the association of converters with
58 // paths on the TDS
59 for (LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ ) {
60 std::string path = (*k).first;
61 for (LeafMap::iterator j = m_leaves.begin(); j != m_leaves.end(); j++ ) {
62 std::string pp = (*j).first.substr(0, (*j).first.rfind("/"));
63 if ( path == pp && path != (*j).first ) {
64 (*k).second->push_back((*j).second);
65 }
66 }
67 }
68
69 }
70
71 return status;
72}
virtual StatusCode addConverters()=0

Referenced by PackedRawDataCnvSvc::initialize().

◆ initialize() [2/2]

virtual StatusCode RawDataCnvSvc::initialize ( )
virtual

Reimplemented in PackedRawDataCnvSvc, and PackedRawDataCnvSvc.

◆ queryInterface() [1/2]

StatusCode RawDataCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Override inherited queryInterface due to enhanced interface.

Reimplemented in PackedRawDataCnvSvc, and PackedRawDataCnvSvc.

Definition at line 150 of file RawDataCnvSvc.cxx.

150 {
151 if ( IID_IRawDataCnvSvc == riid ) {
152 *ppvInterface = (IRawDataCnvSvc*)this;
153 }
154 else {
155 // Interface is not directly availible: try out a base class
156 return ConversionSvc::queryInterface(riid, ppvInterface);
157 }
158 addRef();
159 return StatusCode::SUCCESS;
160}

◆ queryInterface() [2/2]

virtual StatusCode RawDataCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Override inherited queryInterface due to enhanced interface.

Reimplemented in PackedRawDataCnvSvc, and PackedRawDataCnvSvc.

◆ updateServiceState() [1/2]

StatusCode RawDataCnvSvc::updateServiceState ( IOpaqueAddress *  pAddress)
protected

Update state of the service.

Definition at line 96 of file RawDataCnvSvc.cxx.

96 {
97
98 // not sure about the use of recid or bank...
99 MsgStream log(msgSvc(), name());
100
101 StatusCode status = INVALID_ADDRESS;
102 IRegistry* ent = pAddress->registry();
103
104 if ( 0 != ent ) {
105 SmartIF<IDataManagerSvc> iaddrReg( dataProvider());
106 // if ( 0 != iaddrReg ) {
107 status = StatusCode::SUCCESS;
108 std::string path = ent->identifier();
109
110 LeafMap::iterator itm = m_leaves.find(path);
111 if ( itm != m_leaves.end() ) {
112 IRawDataCnvSvc::Leaf* leaf = (*itm).second;
113 if ( 0 != leaf ) {
114 //ipar[0] = leaf->userParameter;
115 for ( Leaf::iterator il = leaf->begin(); il != leaf->end(); il++ ) {
116 IOpaqueAddress* newAddr = 0;
117 unsigned long ipars[2] = {0, 0}; //{(*il)->userParameter, new_rid};
118 const std::string spars[2] = {"", ""}; //{par[0], (*il)->bank};
119 /* fix for Gaidi V16r4 -- Weidong Li 2005.10.25
120 StatusCode ir =
121 addressCreator()->createAddress(storageType,
122 (*il)->clid,
123 spars,
124 ipars,
125 newAddr);
126 */
127 StatusCode ir = createAddress(repSvcType(),
128 (*il)->clid,
129 spars,
130 ipars,
131 newAddr);
132 if ( ir.isSuccess() ) {
133 ir = iaddrReg->registerAddress((*il)->path, newAddr);
134 if ( !ir.isSuccess() ) {
135 newAddr->release();
136 status = ir;
137 }
138 }
139 }
140 }
141 }
142 }
143 else {
144 status = NO_INTERFACE;
145 }
146
147 return status;
148}

Referenced by PackedRawDataCnvSvc::updateServiceState().

◆ updateServiceState() [2/2]

StatusCode RawDataCnvSvc::updateServiceState ( IOpaqueAddress *  pAddress)
protected

Friends And Related Function Documentation

◆ SvcFactory< RawDataCnvSvc >


The documentation for this class was generated from the following files: