ATLAS Offline Software
EDM_MasterSearch.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGSTORAGEDEF_MASTERSEARCH
6 #define TRIGSTORAGEDEF_MASTERSEARCH
8 
9 //this is a struct that allows us to treat constant integral expressions (such as bools)
10 //as types
11 template <typename type, type the_value> struct value_type{
12  static const type value = the_value;
13 };
14 
15 
16 //since due to the functional nature of template programming we need to pass all results/arguments
17 // a la "by reference" (what in normal C++ would be void func(arg1& a1, arg2* a2) we are creating
18 // overall holder structes that hold all arguments and all results that we want from the loop
19 // in a sense this is similar to how main() takes an argv parameter..
20 
21 //our result structure holds a list of bools (implemented as value type) that indicate in which
22 //package list the quesried type was found and a seach_result that gives back the type_info row
23 //if the element was found in any of the packages or a special NOT_KNOWN_IN_EDM type
24 template<typename new_list = HLT::TypeInformation::newlist, typename _search_result = HLT::TypeInformation::nil>
25 struct my_result{
26  typedef new_list list;
27  typedef _search_result search_result;
28 };
29 
30 
31 //this is our argument structure that hold two arguments:
32 //1) a template meta-function (functor) that hold the search method with which we query a typemap
33 //2) a type for which we want to seach for
34 template<template<class E, class L, int I> class _functor, typename _type> struct my_arg{
35 
36  template<class E,class L, int I> struct functor{
37  static const bool result = _functor<E,L,I>::result;
38  };
39 
40  typedef _type type;
41 };
42 
43 
44 template<typename oldresult,typename newresult, bool replace> struct get_result;
45 template<typename oldresult,typename newresult> struct get_result<oldresult,newresult,true>{
46  typedef newresult result;
47 };
48 template<typename oldresult,typename newresult> struct get_result<oldresult,newresult,false>{
49  typedef oldresult result;
50 };
51 
52 //a result handler that we can use to emit a 'nice' error message
53 template<typename queried, typename result, typename T> struct result_handler{
54  typedef result type;
55 };
56 
57 template<typename queried, typename result> struct result_handler<queried, result, HLT::TypeInformation::nil>{
59 };
60 
61 //this is the meta-function that we want to exectue on each package typemap
62 template<typename element, typename last_result, typename arg, bool isLast>
63 struct my_functor{
64 
65  typedef typename
67  typename element::map,
68  arg::template functor
70 
72 
74  typedef typename last_result::list::template add<value_type<bool,query> >::go::done added;
75 
76  //if we did not find the result we just keep our current result and do not replace it
78 
79 
80 
82 };
83 
84 //this structure acutally implements the loop over packages
85 template<typename MASTER_EDM, template <class,class,int> class functor, typename which> struct master_search{
87  MASTER_EDM,
88  my_functor,
91 };
92 
93 
94 #endif
my_result
Definition: EDM_MasterSearch.h:25
master_search::result
HLT::TypeInformation::for_each_type_c< MASTER_EDM, my_functor, my_result<>, my_arg< functor, which > >::type result
Definition: EDM_MasterSearch.h:90
get_generator_info.result
result
Definition: get_generator_info.py:21
HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM
Definition: TypeInformation.h:305
taskman.template
dictionary template
Definition: taskman.py:317
my_result::search_result
_search_result search_result
Definition: EDM_MasterSearch.h:27
athena.value
value
Definition: athena.py:124
my_arg::type
_type type
Definition: EDM_MasterSearch.h:40
value_type::value
static const type value
Definition: EDM_MasterSearch.h:12
result_handler
Definition: EDM_MasterSearch.h:53
master_search
Definition: EDM_MasterSearch.h:85
my_arg::functor
Definition: EDM_MasterSearch.h:36
query
Definition: query.py:1
HLT::TypeInformation::for_each_type_c
Definition: TypeInformation.h:368
my_functor::result_type
HLT::TypeInformation::map_search< typename arg::type, typename element::map, arg::template functor >::type result_type
Definition: EDM_MasterSearch.h:69
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
my_functor::result
get_result< typename last_result::search_result, result_type, query >::result result
Definition: EDM_MasterSearch.h:77
EDM_TypeInformation.h
get_result< oldresult, newresult, false >::result
oldresult result
Definition: EDM_MasterSearch.h:49
my_arg::functor::result
static const bool result
Definition: EDM_MasterSearch.h:37
my_functor::added
last_result::list::template add< value_type< bool, query > >::go::done added
Definition: EDM_MasterSearch.h:74
result_handler::type
result type
Definition: EDM_MasterSearch.h:54
my_arg
Definition: EDM_MasterSearch.h:34
python.Utils.unixtools.which
def which(filename, env=os.environ)
UNIX-style which ---------------------------------------------------------—.
Definition: unixtools.py:39
HLT::TypeInformation::map_search
Definition: TypeInformation.h:300
my_functor
Definition: EDM_MasterSearch.h:63
my_functor::unknown_object
HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM< typename arg::type > unknown_object
Definition: EDM_MasterSearch.h:71
my_functor::type
result_handler< typename arg::type, my_result< added, result >, typename my_result< added, result >::search_result >::type type
Definition: EDM_MasterSearch.h:81
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
get_result
Definition: EDM_MasterSearch.h:44
result_handler< queried, result, HLT::TypeInformation::nil >::type
my_result< typename result::list, HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM< queried > > type
Definition: EDM_MasterSearch.h:58
value_type
Definition: EDM_MasterSearch.h:11
get_result< oldresult, newresult, true >::result
newresult result
Definition: EDM_MasterSearch.h:46
my_result::list
new_list list
Definition: EDM_MasterSearch.h:26