ATLAS Offline Software
IsSTLSequence.h
Go to the documentation of this file.
1 // Yo emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 /***************************************************************************
8  determines whether CONTAINER is one of supported ATLAS sequences Requires
9  CONTAINER to define value_type
10  ----------------------------------------------------------------
11  ATLAS Collaboration
12  ***************************************************************************/
13 
14 // $Id: IsSTLSequence.h,v 1.5 2008-11-17 19:24:52 ssnyder Exp $
15 
16 #ifndef ATHLINKS_TOOLS_ISSTLSEQUENCE_H
17 # define ATHLINKS_TOOLS_ISSTLSEQUENCE_H
18 
19 #include <vector>
20 #include <list>
21 #include <deque>
22 #include <type_traits>
23 
24 
25 
26 // CLASS DECLARATIONS
27 namespace SG {
28  // Some parts of Athena define FLAG as a macro.
29  template <class CONTAINER, class FLAG_>
30  struct TestSequenceTag
31  {
32  typedef std::false_type type;
33  };
34 
35  template <class CONTAINER>
36  struct TestSequenceTag<CONTAINER, typename CONTAINER::isSequence>
37  {
38  typedef typename CONTAINER::isSequence type;
39  };
40 
41  template <class CONTAINER>
42  struct IsSTLSequence {
43  private:
44  // Causes trouble with fwd decls? cf xAODTruth?
45  //BOOST_CONCEPT_ASSERT((boost::ContainerConcept<CONTAINER>));
46  typedef typename CONTAINER::value_type value_type;
47 
48  // vectors
49  typedef typename std::is_base_of< std::vector<value_type>, CONTAINER> isVector;
50 
51  // lists
52  typedef typename std::is_base_of< std::list<value_type>, CONTAINER> isList;
53 
54  // queues
55  typedef typename std::is_base_of< std::deque<value_type>, CONTAINER> isDeque;
56 
57  // explicit tag, by adding
58  // typedef type_tools::true_tag isSequence;
59  // to a class.
61 
62  public:
63  //putting it all together
64  static const bool value =
66  isList::value ||
69  };
70 }
71 #endif // ATHLINKS_TOOLS_ISSTLSEQUENCE_H
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::IsSTLSequence::value_type
CONTAINER::value_type value_type
Definition: IsSTLSequence.h:51
athena.value
value
Definition: athena.py:124
SG::IsSTLSequence::isDeque
std::is_base_of< std::deque< value_type >, CONTAINER > isDeque
Definition: IsSTLSequence.h:60
SG::IsSTLSequence::isVector
std::is_base_of< std::vector< value_type >, CONTAINER > isVector
Definition: IsSTLSequence.h:54
SG::IsSTLSequence
Definition: IsSTLSequence.h:47
SG::IsSTLSequence::value
static const bool value
Definition: IsSTLSequence.h:69
SG::TestSequenceTag::type
std::false_type type
Definition: IsSTLSequence.h:42
SG::IsSTLSequence::isList
std::is_base_of< std::list< value_type >, CONTAINER > isList
Definition: IsSTLSequence.h:57
SG::TestSequenceTag
Definition: IsSTLSequence.h:36
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
SG::IsSTLSequence::hasSequenceTag
TestSequenceTag< CONTAINER, std::true_type >::type hasSequenceTag
Definition: IsSTLSequence.h:65
python.CFElements.isSequence
def isSequence(obj)
Definition: CFElements.py:96