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 "CxxUtils/concepts.h"
28 #include <concepts>
29 #include <utility>
30 #include <type_traits>
31 #include <map>
32 #include <algorithm>
33 #include <cassert>
34 
35 
36 namespace SG {
37 
38 
50 template <CxxUtils::detail::PairAssociativeContainer MAP>
52 {
53 private:
54 
55  typedef typename MAP::mapped_type mapped_type;
56  typedef typename MAP::const_iterator const_iterator;
57 
58 
59 public:
64 
66  typedef typename MAP::key_type index_type;
67 
70 
71 
76  static bool isValid (const stored_index_type& index) ;
77 
78 
84 
85 
90  static void reset (stored_index_type& index);
91 
92 
101  static
103 
104 
113  static void
114  reverseLookup(const MAP& data,
115  ElementConstReference element,
116  index_type& index);
117 };
118 
119 
120 } // namespace SG
121 
122 
124 template <typename KEY, typename ELEM>
125 struct DefaultIndexingPolicy<std::map<KEY, ELEM> > {
127 };
128 
129 
131 
132 
133 #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:66
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:52
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:62
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:61
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:63
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:69
SG::MapIndexingPolicy::isValid
static bool isValid(const stored_index_type &index)
Test to see if an index is valid.
SG::MapIndexingPolicy::const_iterator
MAP::const_iterator const_iterator
Definition: MapIndexingPolicy.h:56
SG::MapIndexingPolicy::mapped_type
MAP::mapped_type mapped_type
Definition: MapIndexingPolicy.h:55
DefaultIndexingPolicy.h
DefaultIndexingPolicy< std::map< KEY, ELEM > >::type
SG::MapIndexingPolicy< std::map< KEY, ELEM > > type
Definition: MapIndexingPolicy.h:126
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
concepts.h
A couple standard-library related concepts.
IndexHolder.h
Store an ElementLink index for non-vector containers.
value_type
Definition: EDM_MasterSearch.h:11
type_tools.h