ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthLinks
AthLinks
tools
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$
14
15
16
#ifndef ATHLINKS_MAPINDEXINGPOLICY_H
17
#define ATHLINKS_MAPINDEXINGPOLICY_H
18
19
20
21
#include "
AthLinks/tools/DefaultIndexingPolicy.h
"
22
#include "
AthLinks/tools/IndexHolder.h
"
23
#include "
AthLinks/exceptions.h
"
24
#include "
AthenaKernel/tools/type_tools.h
"
25
#include "
AthenaKernel/getMessageSvc.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
49
50
template
<CxxUtils::detail::PairAssociativeContainer MAP>
51
class
MapIndexingPolicy
52
{
53
private
:
54
55
typedef
typename
MAP::mapped_type
mapped_type
;
56
typedef
typename
MAP::const_iterator
const_iterator
;
57
58
59
public
:
61
typedef
typename
type_tools::Copy<mapped_type>::type
ElementType
;
62
typedef
typename
type_tools::Copy<mapped_type>::const_reference
ElementConstReference
;
63
typedef
typename
type_tools::Copy<mapped_type>::const_pointer
ElementConstPointer
;
64
66
typedef
typename
MAP::key_type
index_type
;
67
69
typedef
SG::IndexHolder<index_type>
stored_index_type
;
70
71
76
static
bool
isValid
(
const
stored_index_type
&
index
) ;
77
78
83
static
index_type
storedToExternal
(
stored_index_type
index
);
84
85
90
static
void
reset
(
stored_index_type
&
index
);
91
92
101
static
102
ElementType
lookup
(
const
stored_index_type
&
index
,
const
MAP& data);
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> > {
126
typedef
SG::MapIndexingPolicy<std::map<KEY, ELEM>
>
type
;
127
};
128
129
130
#include "
AthLinks/tools/MapIndexingPolicy.icc
"
131
132
133
#endif
// not ATHLINKS_MAPINDEXINGPOLICY_H
exceptions.h
Exceptions that can be thrown from AthLinks.
DefaultIndexingPolicy.h
IndexHolder.h
Store an ElementLink index for non-vector containers.
MapIndexingPolicy.icc
SG::IndexHolder
Store an ElementLink index for non-vector containers.
Definition
IndexHolder.h:33
SG::MapIndexingPolicy
Indexing policy for a map-like container.
Definition
MapIndexingPolicy.h:52
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
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::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::const_iterator
MAP::const_iterator const_iterator
Definition
MapIndexingPolicy.h:56
SG::MapIndexingPolicy::ElementConstReference
type_tools::Copy< mapped_type >::const_reference ElementConstReference
Definition
MapIndexingPolicy.h:62
SG::MapIndexingPolicy::storedToExternal
static index_type storedToExternal(stored_index_type index)
Convert from stored to external index types.
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::reverseLookup
static void reverseLookup(const MAP &data, ElementConstReference element, index_type &index)
Find the index of the (first) instance of ELEMENT in DATA.
SG::MapIndexingPolicy::isValid
static bool isValid(const stored_index_type &index)
Test to see if an index is valid.
SG::MapIndexingPolicy::reset
static void reset(stored_index_type &index)
Make an index invalid.
SG::MapIndexingPolicy::mapped_type
MAP::mapped_type mapped_type
Definition
MapIndexingPolicy.h:55
SG::MapIndexingPolicy::ElementConstPointer
type_tools::Copy< mapped_type >::const_pointer ElementConstPointer
Definition
MapIndexingPolicy.h:63
map
STL class.
concepts.h
A couple standard-library related concepts.
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
index
Definition
index.py:1
std
STL namespace.
DefaultIndexingPolicy< std::map< KEY, ELEM > >::type
SG::MapIndexingPolicy< std::map< KEY, ELEM > > type
Definition
MapIndexingPolicy.h:126
DefaultIndexingPolicy
Definition
DefaultIndexingPolicy.h:23
type_tools::Copy::type
T type
Definition
type_tools.h:52
type_tools::Copy::const_reference
const T & const_reference
Definition
type_tools.h:53
type_tools::Copy::const_pointer
const T * const_pointer
Definition
type_tools.h:54
type_tools.h
Generated on
for ATLAS Offline Software by
1.17.0