3 #ifndef GAUDIUTILS_GETDATA_H
4 #define GAUDIUTILS_GETDATA_H 1
49 template <
class CONTAINER>
54 template <
class CONTAINER>
98 template <
class COMMON>
100 (
const COMMON& common ,
103 const bool checkData =
true)
const
106 return_type obj = getFromTS<Type>(service, location);
108 common.Assert(obj,
"get():: No valid data at '" + location +
"'");
112 common.debug() <<
"The object of type '"
115 << (obj ?
"has been" :
"could not be")
116 <<
" retrieved from TS at address '"
117 << location <<
"'" <<
endmsg ;
126 template <
class TYPE>
132 typedef Gaudi::Range_<std::vector<const TYPE*> >
Type ;
144 template <
class COMMON>
146 (
const COMMON& common ,
149 const bool checkData =
true)
const
153 DataObject*
object =
this -> getData ( service , location ) ;
157 typedef typename TYPE::Selection Selection_;
158 const Selection_*
sel =
dynamic_cast<Selection_*
> ( object ) ;
162 { common.debug() <<
"The object of type '"
164 <<
"' has been retrieved from TS at address '"
165 << location <<
"'" <<
endmsg ; }
166 return make_range ( sel ) ;
169 typedef typename TYPE::Container Container_ ;
170 const Container_* cnt =
dynamic_cast<Container_*
> ( object ) ;
174 { common.debug() <<
"The object of type '"
176 <<
"' has been retrieved from TS at address '"
177 << location <<
"'" <<
endmsg ; }
178 return make_range ( cnt ) ;
182 common.Assert (
false ,
"get():: No valid data at '" + location +
"'" ) ;
186 common.Assert (
false ,
"get():: No data at '" + location +
"'" ) ;
194 return_type make_range (
const typename TYPE::Container* cnt )
const
197 return_type make_range (
const typename TYPE::Selection* cnt )
const
198 {
return 0 == cnt ?
return_type() : return_type ( cnt->begin() , cnt->end() ) ; }
211 service , 0 , location ) ;
217 template <
class ITERATOR>
218 return_type make_range
220 ITERATOR last )
const
222 typename return_type::const_iterator* _begin =
reinterpret_cast<typename return_type::const_iterator*
>(&first);
223 typename return_type::const_iterator* _end =
reinterpret_cast<typename return_type::const_iterator*
>(&last);
230 template <
class TYPE>
236 typedef Gaudi::NamedRange_<std::vector<const TYPE*> >
Type ;
248 template <
class COMMON>
250 (
const COMMON& common ,
253 const bool checkData =
true)
const
255 return return_type ( m_range( common , service , location, checkData ) , location ) ;
261 return_type make_range (
const typename TYPE::Container* cnt )
const
270 return_type make_range (
const typename TYPE::Selection* cnt )
const
286 {
return m_range.getData ( service , location ) ; }
296 template <
class TYPE>
300 template <
class TYPE>
304 template <
class TYPE>
315 template <
class TYPE>
326 inline bool operator()
331 return getFromTS<TYPE>(service, location);
337 template <
class TYPE>
348 inline bool operator()
352 DataObject*
object = this->getData( service , location ) ;
353 if ( 0 ==
object ) {
return false ; }
355 0 !=
dynamic_cast<typename TYPE::Selection*
> ( object ) ||
356 0 != dynamic_cast<typename TYPE::Container*> (
object ) ;
372 service , 0 , location ) ;
379 template <
class TYPE>
381 :
public CheckData<Gaudi::Range_<std::vector<const TYPE*> > > {} ;
384 template <
class TYPE>
388 template <
class TYPE>
392 template <
class TYPE>
403 template <
class TYPE,
class TYPE2>
425 template <
class COMMON>
427 (
const COMMON& common ,
435 TYPE2* o =
new TYPE2() ;
436 common.put ( service , o , location2 ) ;
438 { common.debug() <<
"The object of type '"
440 <<
"' has been created from TS at address '"
441 << location2 <<
"'" <<
endmsg ; }
447 common.Assert ( !(!ret) ,
"get():: No valid data at '" + location +
"'" ) ;
449 { common.debug() <<
"The object of type '"
451 <<
"' has been retrieved from TS at address '"
452 << location <<
"'" <<
endmsg ; }
459 template <
class TYPE,
class TYPE2>
464 typedef Gaudi::Range_<std::vector<const TYPE*> >
Range ;
484 template <
class COMMON>
486 (
const COMMON& common ,
491 DataObject* obj = m_getter.getData ( service , location ) ;
494 TYPE2* o =
new TYPE2() ;
495 common.put ( service , o , location2 ) ;
497 { common.debug() <<
"The object of type '"
499 <<
"' has been created from TS at address '"
500 << location2 <<
"'" <<
endmsg ; }
502 return m_getter ( common , service , location ) ;
513 template <
class TYPE,
class TYPE2>
518 typedef Gaudi::NamedRange_<std::vector<const TYPE*> >
Range ;
519 typedef Gaudi::Range_<std::vector<const TYPE*> >
Range_ ;
538 template <
class COMMON>
540 (
const COMMON& common ,
548 location2 ) , location ) ;
558 template <
class TYPE,
class TYPE2>
561 template <
class TYPE,
class TYPE2>
564 template <
class TYPE,
class TYPE2>
568 template <
class TYPE,
class TYPE2>
571 template <
class TYPE,
class TYPE2>
574 template <
class TYPE,
class TYPE2>
578 template <
class TYPE,
class TYPE2>
581 template <
class TYPE,
class TYPE2>
584 template <
class TYPE,
class TYPE2>
594 #endif // GAUDIUTILS_GETDATA_H