| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Converter.cpp
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/src/Lib/Converter.cpp,v 1.17 2007/12/12 16:02:32 marcocle Exp $
2
3 // Include Files
4 #include "GaudiKernel/Converter.h"
5 #include "GaudiKernel/INamedInterface.h"
6 #include "GaudiKernel/ISvcLocator.h"
7 #include "GaudiKernel/IMessageSvc.h"
8 #include "GaudiKernel/IDataManagerSvc.h"
9 #include "GaudiKernel/IDataProviderSvc.h"
10 #include "GaudiKernel/GaudiException.h"
11 #include "GaudiKernel/ServiceLocatorHelper.h"
12 #include "GaudiKernel/ThreadGaudi.h"
13 #include "GaudiKernel/ConversionSvc.h"
14
16 const CLID& Converter::objType() const {
17 return m_classType;
18 }
19
21 long Converter::i_repSvcType() const {
22 return m_storageType;
23 }
24
26 StatusCode Converter::createObj(IOpaqueAddress*, DataObject*&) {
27 return StatusCode::SUCCESS;
28 }
29
30
32 StatusCode Converter::fillObjRefs(IOpaqueAddress*, DataObject*) {
33 return StatusCode::SUCCESS;
34 }
35
37 StatusCode Converter::updateObj(IOpaqueAddress*, DataObject*) {
38 return StatusCode::SUCCESS;
39 }
40
42 StatusCode Converter::updateObjRefs(IOpaqueAddress*, DataObject*) {
43 return StatusCode::SUCCESS;
44 }
45
47 StatusCode Converter::createRep(DataObject*, IOpaqueAddress*&) {
48 return StatusCode::SUCCESS;
49 }
50
52 StatusCode Converter::fillRepRefs(IOpaqueAddress*, DataObject*) {
53 return StatusCode::SUCCESS;
54 }
55
57 StatusCode Converter::updateRep(IOpaqueAddress*, DataObject*) {
58 return StatusCode::SUCCESS;
59 }
60
62 StatusCode Converter::updateRepRefs(IOpaqueAddress*, DataObject*) {
63 return StatusCode::SUCCESS;
64 }
65
67 StatusCode Converter::initialize() {
68 // Get a reference to the Message Service
69 if ( !msgSvc().isValid() ) {
70 return StatusCode::FAILURE;
71 }
72 return StatusCode::SUCCESS;
73 }
74
76 StatusCode Converter::finalize() {
77 // release services
78 m_messageSvc = 0;
79 m_dataManager = 0;
80 m_dataProvider = 0;
81 m_conversionSvc = 0;
82 m_addressCreator = 0;
83 return StatusCode::SUCCESS;
84 }
85
87 StatusCode Converter::setDataProvider(IDataProviderSvc* svc) {
88 m_dataProvider = svc;
89 m_dataManager = svc;
90 return StatusCode::SUCCESS;
91 }
92
94 SmartIF<IDataProviderSvc>& Converter::dataProvider() const {
95 return m_dataProvider;
96 }
97
99 SmartIF<IDataManagerSvc>& Converter::dataManager() const {
100 return m_dataManager;
101 }
102
104 StatusCode Converter::setConversionSvc(IConversionSvc* svc) {
105 m_conversionSvc = svc;
106 return StatusCode::SUCCESS;
107 }
108
110 SmartIF<IConversionSvc>& Converter::conversionSvc() const {
111 return m_conversionSvc;
112 }
113
115 StatusCode Converter::setAddressCreator(IAddressCreator* creator) {
116 m_addressCreator = creator;
117 return StatusCode::SUCCESS;
118 }
119
121 SmartIF<IAddressCreator>& Converter::addressCreator() const {
122 return m_addressCreator;
123 }
124
126 SmartIF<ISvcLocator>& Converter::serviceLocator() const {
127 return m_svcLocator;
128 }
129
131 SmartIF<IMessageSvc>& Converter::msgSvc() const {
132 if ( !m_messageSvc.isValid() ) {
133 m_messageSvc = serviceLocator();
134 if( !m_messageSvc.isValid() ) {
135 throw GaudiException("Service [MessageSvc] not found", "Converter", StatusCode::FAILURE);
136 }
137 }
138 return m_messageSvc;
139 }
140
141 // Obsoleted name, kept due to the backwards compatibility
142 SmartIF<IMessageSvc>& Converter::messageService() const {
143 return msgSvc();
144 }
145
147 Converter::Converter(long storage_type, const CLID& class_type, ISvcLocator* svc) :
148 m_storageType(storage_type),
149 m_classType(class_type),
150 m_svcLocator(svc)
151 {
152 }
153
155 Converter::~Converter() {
156 }
157
158 StatusCode
159 Converter::service_i(const std::string& svcName, bool createIf,
160 const InterfaceID& iid, void** ppSvc) const {
161 // Check for name of conversion service
162 SmartIF<INamedInterface> cnvsvc(conversionSvc());
163 if (cnvsvc.isValid()) {
164 const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
165 return helper.getService(svcName, createIf, iid, ppSvc);
166 }
167 return StatusCode::FAILURE;
168 }
169
170 StatusCode
171 Converter::service_i(const std::string& svcType, const std::string& svcName,
172 const InterfaceID& iid, void** ppSvc) const {
173 // Check for name of conversion service
174 SmartIF<INamedInterface> cnvsvc(conversionSvc());
175 if (cnvsvc.isValid()) {
176 const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
177 return helper.createService(svcType, svcName, iid, ppSvc);
178 }
179 return StatusCode::FAILURE;
180 }
181
182 SmartIF<IService> Converter::service(const std::string& name, const bool createIf) const {
183 SmartIF<INamedInterface> cnvsvc(conversionSvc());
184 SmartIF<IService> svc;
185 if (cnvsvc.isValid()) {
186 const ServiceLocatorHelper helper(*serviceLocator(), "Converter", cnvsvc->name());
187 svc = helper.service(name, false, createIf);
188 }
189 return svc;
190 }