ATLAS Offline Software
MapIndexingPolicy.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
16 #ifndef ATHLINKS_MAPINDEXINGPOLICY_H
17 #define ATHLINKS_MAPINDEXINGPOLICY_H
18 
19 
20 
23 #include "AthLinks/exceptions.h"
26 #include "GaudiKernel/MsgStream.h"
27 #include <boost/concept_check.hpp>
28 #include <map>
29 #include <algorithm>
30 #include <cassert>
31 
32 
33 namespace SG {
34 
35 
46 template <class MAP>
48 {
49 private:
50  //compiler checks that MAP is an stl pair associative container
51  BOOST_CONCEPT_ASSERT((boost::PairAssociativeContainerConcept<MAP>));
52 
53  typedef typename MAP::mapped_type mapped_type;
54  typedef typename MAP::const_iterator const_iterator;
55 
56 
57 public:
62 
64  typedef typename MAP::key_type index_type;
65 
68 
69 
74  static bool isValid (const stored_index_type& index) ;
75 
76 
82 
83 
88  static void reset (stored_index_type& index);
89 
90 
99  static
101 
102 
111  static void
112  reverseLookup(const MAP& data,
113  ElementConstReference element,
114  index_type& index);
115 };
116 
117 
118 } // namespace SG
119 
120 
122 template <typename KEY, typename ELEM>
123 struct DefaultIndexingPolicy<std::map<KEY, ELEM> > {
125 };
126 
127 
129 
130 
131 #endif // not ATHLINKS_MAPINDEXINGPOLICY_H
SG::MapIndexingPolicy::index_type
MAP::key_type index_type
The type of an index, as provided to or returned from a link.
Definition: MapIndexingPolicy.h:64
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SG::MapIndexingPolicy::reset
static void reset(stored_index_type &index)
Make an index invalid.
SG::MapIndexingPolicy
Indexing policy for a map-like container.
Definition: MapIndexingPolicy.h:48
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
SG::MapIndexingPolicy::ElementConstReference
type_tools::Copy< mapped_type >::const_reference ElementConstReference
Definition: MapIndexingPolicy.h:60
index
Definition: index.py:1
SG::MapIndexingPolicy::ElementType
type_tools::Copy< mapped_type >::type ElementType
The type we get when we dereference a link, and derived types.
Definition: MapIndexingPolicy.h:59
SG::MapIndexingPolicy::lookup
static ElementType lookup(const stored_index_type &index, const MAP &data)
Retrieve from a container the element corresponding to an index.
SG::MapIndexingPolicy::storedToExternal
static index_type storedToExternal(stored_index_type index)
Convert from stored to external index types.
SG::MapIndexingPolicy::ElementConstPointer
type_tools::Copy< mapped_type >::const_pointer ElementConstPointer
Definition: MapIndexingPolicy.h:61
SG::MapIndexingPolicy::stored_index_type
SG::IndexHolder< index_type > stored_index_type
The type of an index, as stored internally within a link.
Definition: MapIndexingPolicy.h:67
SG::MapIndexingPolicy::isValid
static bool isValid(const stored_index_type &index)
Test to see if an index is valid.
SG::MapIndexingPolicy::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::PairAssociativeContainerConcept< MAP >))
SG::MapIndexingPolicy::const_iterator
MAP::const_iterator const_iterator
Definition: MapIndexingPolicy.h:54
SG::MapIndexingPolicy::mapped_type
MAP::mapped_type mapped_type
Definition: MapIndexingPolicy.h:53
DefaultIndexingPolicy.h
DefaultIndexingPolicy< std::map< KEY, ELEM > >::type
SG::MapIndexingPolicy< std::map< KEY, ELEM > > type
Definition: MapIndexingPolicy.h:124
SG::MapIndexingPolicy::reverseLookup
static void reverseLookup(const MAP &data, ElementConstReference element, index_type &index)
Find the index of the (first) instance of ELEMENT in DATA.
SG::IndexHolder
Store an ElementLink index for non-vector containers.
Definition: IndexHolder.h:33
MapIndexingPolicy.icc
DefaultIndexingPolicy
Definition: DefaultIndexingPolicy.h:23
IndexHolder.h
Store an ElementLink index for non-vector containers.
value_type
Definition: EDM_MasterSearch.h:11
type_tools.h