test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
traits.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_traits_h
2 #define DataFormats_Common_traits_h
3 
4 /*----------------------------------------------------------------------
5 
6 Definition of traits templates used in the EDM.
7 
8 
9 ----------------------------------------------------------------------*/
10 
11 #include <deque>
12 #include <limits>
13 #include <list>
14 #include <map>
15 #include <set>
16 #include <string>
17 #include <utility>
18 #include <vector>
19 
20 namespace edm
21 {
22  //------------------------------------------------------------
23  //
24  // The trait struct template key_traits<K> is used to carry
25  // information relevant to the type K when used as a 'key' in
26  // RefVector and its related classes and templates.
27  //
28  // The general case works only for integral types K; for more
29  // 'esoteric' types, one must introduce an explicit specialization.
30  // That specialization must initialize the static data member
31  // 'value'.
32 
33  template <class K>
34  struct key_traits
35  {
36  typedef K key_type;
37  static const key_type value;
38  };
39 
40  template <class K>
41  typename key_traits<K>::key_type const
43  std::numeric_limits<typename key_traits<K>::key_type>::max();
44 
45  // Partial specialization for std::pair
46 
47  template <class U, class V>
48  struct key_traits<std::pair<U,V> >
49  {
50  typedef std::pair<U,V> key_type;
51  static const key_type value;
52  };
53 
54  template <class U, class V>
55  typename key_traits<std::pair<U,V> >::key_type const
58 
59  // If we ever need to support instantiations of std::basic_string
60  // other than std::string, this is the place to do it.
61 
62  // For value, we make a 1-character long string that contains an
63  // unprintable character; we are hoping nobody ever uses such a
64  // string as a legal key.
65  template <>
66  struct key_traits<std::string>
67  {
69  static const key_type value;
70  };
71 
72 
73  //------------------------------------------------------------
74  //
75  // DoNotSortUponInsertion is a base class. Derive your own class X
76  // from DoNotSortUponInsertion when:
77  //
78  // 1. You want to use DetSetVector<X> as an EDProduct, but
79  //
80  // 2. You do *not* want the Event::put member template to cause the
81  // DetSet<X> instances within the DetSetVector<X> to be sorted.
82  //
83  // DoNotSortUponInsertion has no behavior; it is used at compile
84  // time to influence the behavior of Event::put.
85  //
86  // Usage:
87  // class MyClass : public edm::DoNotSortUponInsertion { ... }
88  //
90 
91  //------------------------------------------------------------
92  //
93  // DoNotRecordParents is a base class. Derive your own (EDProduct)
94  // class X from DoNotRecordParents when your class already keeps all
95  // data that are relevant to parentage internally, and the
96  // information kept by the event model would thus be redundant.
97  //
98  // DoNotRecordParents has no behavior; it is used at compile time to
99  // influence the behavior of Event::put.
100  //
101  // Usage:
102  // class MyClass : public edm::DoNotRecordParents { ... }
103  struct DoNotRecordParents { };
104 
105  // Other is a base class. NEVER USE IT. It is for the
106  // core of the event model only.
107  struct Other { };
108 
109  //------------------------------------------------------------
110  //
111  // The trait struct template has_fillView<T> is used to
112  // indicate whether or not the type T has a member function
113  //
114  // void T::fillView(std::vector<void const*>&) const
115  //
116  // We assume the 'general case' for T is to not support fillView.
117  // Classes which do support fillView must specialize this trait.
118  //
119  //------------------------------------------------------------
120 
121  template <class T>
123  {
124  static bool const value = false;
125  };
126 
127  template <class T, class A>
128  struct has_fillView<std::vector<T,A> >
129  {
130  static bool const value = true;
131  };
132 
133  template <class A>
134  struct has_fillView<std::vector<bool,A> >
135  {
136  static bool const value = false;
137  };
138 
139  template <class T, class A>
140  struct has_fillView<std::list<T,A> >
141  {
142  static bool const value = true;
143  };
144 
145  template <class T, class A>
146  struct has_fillView<std::deque<T,A> >
147  {
148  static bool const value = true;
149  };
150 
151  template <class T, class A>
152  struct has_fillView<std::set<T,A> >
153  {
154  static bool const value = true;
155  };
156 
157 
158  //------------------------------------------------------------
159  //
160  // The trait struct template has_setPtr<T> is used to
161  // indicate whether or not the type T has a member function
162  //
163  // void T::setPtr(const std::type_info&, void const*&) const
164  //
165  // We assume the 'general case' for T is to not support setPtr.
166  // Classes which do support setPtr must specialize this trait.
167  //
168  //------------------------------------------------------------
169 
170  template <class T>
171  struct has_setPtr
172  {
173  static bool const value = false;
174  };
175 
176  template <class T, class A>
177  struct has_setPtr<std::vector<T,A> >
178  {
179  static bool const value = true;
180  };
181 
182  template <class A>
183  struct has_setPtr<std::vector<bool,A> >
184  {
185  static bool const value = false;
186  };
187 
188  template <class T, class A>
189  struct has_setPtr<std::list<T,A> >
190  {
191  static bool const value = true;
192  };
193 
194  template <class T, class A>
195  struct has_setPtr<std::deque<T,A> >
196  {
197  static bool const value = true;
198  };
199 
200  template <class T, class A>
201  struct has_setPtr<std::set<T,A> >
202  {
203  static bool const value = true;
204  };
205 }
206 
207 #endif
static bool const value
Definition: traits.h:173
static const key_type value
Definition: traits.h:37
static const key_type value
Definition: traits.h:51
static const key_type value
Definition: traits.h:69
static bool const value
Definition: traits.h:124
std::pair< U, V > key_type
Definition: traits.h:50
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:142