ATLAS Offline Software
Loading...
Searching...
No Matches
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
11template <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
24template<typename new_list = HLT::TypeInformation::newlist, typename _search_result = HLT::TypeInformation::nil>
25struct 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
34template<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
44template<typename oldresult,typename newresult, bool replace> struct get_result;
45template<typename oldresult,typename newresult> struct get_result<oldresult,newresult,true>{
46 typedef newresult result;
47};
48template<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
53template<typename queried, typename result, typename T> struct result_handler{
54 typedef result type;
55};
56
57template<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
62template<typename element, typename last_result, typename arg, bool isLast>
64
65 typedef typename
66 HLT::TypeInformation::map_search<typename arg::type,
67 typename element::map,
68 arg::template functor
70
72
73 static const bool query = !std::is_same<unknown_object,result_type>::value;
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
85template<typename MASTER_EDM, template <class,class,int> class functor, typename which> struct master_search{
87 MASTER_EDM,
91};
92
93
94#endif
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition query.py:1
HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< get_strictly_feat, T > >::type result
static const bool result
get_result< typenamelast_result::search_result, result_type, query >::result result
HLT::TypeInformation::map_search< typenamearg::type, typenameelement::map, arg::templatefunctor >::type result_type
result_handler< typenamearg::type, my_result< added, result >, typenamemy_result< added, result >::search_result >::type type
last_result::list::template add< value_type< bool, query > >::go::done added
HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM< typename arg::type > unknown_object
_search_result search_result
new_list list
my_result< typename result::list, HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM< queried > > type
static const type value