1// dear emacs this is -*- c++ -*-
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
8#ifndef TrigNavigation_NavigationInit_icc
9#define TrigNavigation_NavigationInit_icc
11//#include "GaudiKernel/MsgStream.h"
14#include "AthContainers/ConstDataVector.h"
15#include "TrigNavigation/Holder.h"
16#include "TrigNavigation/Holder.icc"
18#include "TrigNavigation/Navigation.h"
19#include "TrigNavigation/Navigation.icc"
21#include "TrigNavigation/NavigationCore.h"
22#include "TrigNavigation/NavigationCore.icc"
24#include "TrigNavigation/TypeMaps.h"
25#include "TrigNavigation/TrigFeatureLink.h"
32struct FeatureLinkMethods {
33 typedef const T* (HLT::NavigationCore::*fl2o)( const TrigFeatureLink& ) const;
34 typedef TrigFeatureLink (HLT::NavigationCore::*o2fl_1)(const HLT::TriggerElement*, const std::string&, const T*) const;
38struct FeatureLinkMethods2 {
39 typedef typename Container2Object<T>::type Contained;
40 typedef TrigFeatureLink (HLT::NavigationCore::*o2fl_2)(const HLT::TriggerElement*, const std::string&, const Contained*, const T* ) const;
45 /////////////////////////////////////////////////////
46template<class T, bool> struct acquire_featureLinkToObject;
48struct acquire_featureLinkToObject<T, false> {
49 // typename FF<T>::type;
50 static typename FeatureLinkMethods<T>::fl2o do_it() {
51 return &HLT::NavigationCore::featureLink2Object<T>;}
54template<class T> struct acquire_featureLinkToObject<T, true>{
55 static typename FeatureLinkMethods<T>::fl2o do_it() {
59 /////////////////////////////////////////////////////
60template<class T, bool FeatureIsContainer> struct acquire_getRecentFeatureConstDV;
62struct acquire_getRecentFeatureConstDV<T, true> {
63 typedef bool (HLT::NavigationCore::*type)( const HLT::TriggerElement*,
64 const ConstDataVector<T>*&, const std::string&,
65 const HLT::TriggerElement*&, std::string& ) const;
66 static type do_it() { return &HLT::NavigationCore::getRecentFeature<ConstDataVector<T>>; }
70struct acquire_getRecentFeatureConstDV<T, false> {
72 static type do_it() { return 0; }
75 /////////////////////////////////////////////////////
79struct ConstDVCompatible{
80 typedef char yes[2];typedef char no[1];
83 // template<typename X, X>
88 // static auto f(Help<decltype(&C::resize),&C::resize>*) -> yes&;
89 static yes& f(decltype(&C::resize));
92 // static auto f(...) -> no&;
95 static const bool value = sizeof(f<T>(0)) == sizeof(yes);
100 /////////////////////////////////////////////////////
102template<class T, bool FeatureIsContainer> struct acquire_attachFeatureConstDV;
104struct acquire_attachFeatureConstDV<T, true> {
105 typedef bool (HLT::Navigation::*type)( HLT::TriggerElement*, const ConstDataVector<T>*,
106 HLT::Navigation::MemoryManagement, std::string&, const std::string& );
108 static type do_it() {
109 return &HLT::Navigation::attachFeature<T>;
114struct acquire_attachFeatureConstDV<T, false> {
116 static type do_it() { return 0; }
124//struct O2FLMethod_1 {
125// typedef TrigFeatureLink (HLT::NavigationCore::*o2fl_1)(const HLT::TriggerElement*, const std::string&, const T*);
128template<class T, bool> struct acquire_object2FeatureLink1;
129template<class T> struct acquire_object2FeatureLink1<T, true> {
130 static typename FeatureLinkMethods<T>::o2fl_1 do_it() {
131 return &HLT::NavigationCore::object2FeatureLink<T>;
134template<class T> struct acquire_object2FeatureLink1<T, false> {
135 static typename FeatureLinkMethods<T>::o2fl_1 do_it() {
141template<class T, bool> struct acquire_object2FeatureLink2;
142template<class T> struct acquire_object2FeatureLink2<T, false> {
143 static typename FeatureLinkMethods2<T>::o2fl_2 do_it() {
144 return &HLT::NavigationCore::object2FeatureLink<T>;
147template<class T> struct acquire_object2FeatureLink2<T, true> {
148 static typename FeatureLinkMethods2<T>::o2fl_2 do_it() {
153template<typename C, bool>
154struct instantiate_dataelementlink;
157struct instantiate_dataelementlink<C,true>{
160 bool (HLT::NavigationCore::*temp)(const HLT::TriggerElement*,DataLink<C>& link,
161 const std::string&, const HLT::TriggerElement*&, std::string&) const;
162 temp = &HLT::NavigationCore::getRecentFeatureDataOrElementLink<DataLink<C> >;
163 //std::cout << "DataLink version instantiated for " << ClassID_traits<C>::ID() << std::endl;
168struct instantiate_dataelementlink<C,false>{
171 bool (HLT::NavigationCore::*temp)(const HLT::TriggerElement*,ElementLink<C>& link,
172 const std::string&, const HLT::TriggerElement*&, std::string&) const;
173 temp = &HLT::NavigationCore::getRecentFeatureDataOrElementLink<ElementLink<C> >;
174 //std::cout << "ElementLink version instantiated for " << ClassID_traits<C>::typeName() << std::endl;
178template <class T, class C>
179HLT::FeatureContainerInit<T, C>::FeatureContainerInit() {
180 HLT::TypeMaps::registerFeatureContainer<T, C>();
182 // staements below force generation of the specializations for the methods
184 bool (HLT::Navigation::*temp_attachFeature)( TriggerElement*, const T*,
185 Navigation::MemoryManagement, std::string&, const std::string& );
186 temp_attachFeature = &HLT::Navigation::attachFeature<T>;
189 bool (HLT::Navigation::*temp_associateExternalCollection)( const std::string& );
190 temp_associateExternalCollection = &HLT::Navigation::associateExternalCollection<T>;
195 typename acquire_attachFeatureConstDV<T, std::is_same<T,C>::value && ConstDVCompatible<T>::value>::type temp_attachFeatureConstDV;
196 temp_attachFeatureConstDV = acquire_attachFeatureConstDV<T,
197 std::is_same<T,C>::value &&
198 ConstDVCompatible<T>::value
201 // typename acquire_getRecentFeatureConstDV<T, std::is_same<T,C>::value>::type temp_getRecentFeatureConstDV;
202 // temp_getRecentFeatureConstDV = acquire_getRecentFeatureConstDV<T, std::is_same<T,C>::value>::do_it();
207 bool (HLT::NavigationCore::*temp_getFeatures)( const TriggerElement*, std::vector< const T*>&,
208 const std::string&, std::map<const T*, std::string>* ) const;
209 temp_getFeatures = &HLT::NavigationCore::getFeatures<T>;
214 bool (HLT::NavigationCore::*temp_getFeature)( const TriggerElement*, const T*&, const std::string&, std::string&) const;
215 temp_getFeature = &HLT::NavigationCore::getFeature<T>;
218 //const T* (HLT::NavigationCore::*temp_featureLink2Object)( const TrigFeatureLink& );
220 typename FeatureLinkMethods<T>::fl2o temp_featureLink2Object;
221 temp_featureLink2Object = acquire_featureLinkToObject<T, std::is_same<T, C>::value>::do_it();//&HLT::NavigationCore::featureLink2Object<T>;
225 typename FeatureLinkMethods<T>::o2fl_1 temp_object2FeatureLink;
226 temp_object2FeatureLink = acquire_object2FeatureLink1<T, std::is_same<T, C>::value>::do_it();
230 typename FeatureLinkMethods2<C>::o2fl_2 temp_object2FeatureLink2;
231 temp_object2FeatureLink2 = acquire_object2FeatureLink2<C, std::is_same<T, C>::value>::do_it();
235 bool (HLT::NavigationCore::*temp_getRecentFeatures)( const TriggerElement*,
236 std::vector< const T*>&, const std::string&,
237 std::map<const T*, std::string>* ) const;
238 temp_getRecentFeatures = &HLT::NavigationCore::getRecentFeatures<T>;
242 bool (HLT::NavigationCore::*temp_getRecentFeature)( const TriggerElement*,
243 const T*&, const std::string&, const TriggerElement*&, std::string& ) const;
244 temp_getRecentFeature = &HLT::NavigationCore::getRecentFeature<T>;
248 typename acquire_getRecentFeatureConstDV<T, std::is_same<T,C>::value and canTransfer<C>::value >::type temp_getRecentFeatureConstDV;
249 temp_getRecentFeatureConstDV = acquire_getRecentFeatureConstDV<T, std::is_same<T,C>::value and canTransfer<C>::value>::do_it();
254 bool (HLT::NavigationCore::*temp_getRecentFeaturesLinks)( const TriggerElement*,
255 ElementLinkVector<C>&, const std::string& ) const;
256 temp_getRecentFeaturesLinks = &HLT::NavigationCore::getRecentFeaturesLinks<C,T>;
261 bool (HLT::NavigationCore::*temp_getRecentFeatureLink)( const TriggerElement*,
262 ElementLink<C>&, const std::string&, const TriggerElement*&, std::string& ) const;
263 temp_getRecentFeatureLink = &HLT::NavigationCore::getRecentFeatureLink<C,T>;
265 //getRecentFeatureDataOrElementLink depends on what kind of feature we have
266 //therefore we need to outsource to helper
267 instantiate_dataelementlink<C,std::is_same<T,C>::value >::do_it();
271 bool (HLT::NavigationCore::*temp_getFeaturesInRoI)( const TriggerElement*, std::vector<const T*>&,
272 const std::string&, std::map<const T*, std::string>* ) const;
273 temp_getFeaturesInRoI = &HLT::NavigationCore::getFeaturesInRoI<T>;
277 bool (HLT::NavigationCore::*temp_getAllFeatures)(ElementLinkVector<C>&, const std::string& ) const;
278 temp_getAllFeatures = &HLT::NavigationCore::getAllFeatures<C,T>;
282 bool (HLT::Navigation::*temp_findOwners)(const T*, std::vector<const TriggerElement*>&, unsigned int);
283 temp_findOwners = &HLT::Navigation::findOwners<T>;
286 typedef const std::string const_string;
288 const_string (HLT::Navigation::*temp_getNextKey)( const std::string& );
289 temp_getNextKey = &HLT::Navigation::getNextKey<T>;
294 const_string (HLT::Navigation::*temp_getUniqueKey)( const std::string&);
295 temp_getUniqueKey = &HLT::Navigation::getUniqueKey<T>;
300HLT::AuxInit<T>::AuxInit() {
301 HLT::TypeMaps::registerType<T>();