ATLAS Offline Software
Loading...
Searching...
No Matches
SGELVRef.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHLINKS_TOOLS_SGELVREF_H
6#define ATHLINKS_TOOLS_SGELVREF_H
7
8#include "AthLinks/DataLink.h"
9#include "AthLinks/ElementLink.h"
10#include <algorithm>
11#include <exception>
12#include <functional>
13#include <vector>
14
15
16
17template <typename DOBJ>
19
25
26namespace SG {
27 template <typename DOBJ>
28 class ELVRef
29 {
30 public:
31 typedef typename std::vector< DataLink<DOBJ> > DataLinkVector;
34 typedef typename ElemLink::IndexingPolicy IndexingPolicy;
38 typedef typename ElemLink::ID_type ID_type;
39
41 ELVRef(const ELVRef& rhs);
43 ELVRef& operator=(const ELVRef& rhs);
47 ELVRef(typename DataLinkVector::size_type hostIndex,
49 const ElemLinkVec& owner);
51 ID_type dataID() const;
55 ElementConstPointer cptr() const { return m_link.cptr(); }
56
58 const ElemLink& elementLink() const { return m_link; }
59
61
62 bool operator == (const ELVRef& rhs) const {
63 return ( (index() == rhs.index()) && (dataID() == rhs.dataID()) );
64 }
65 bool operator < (const ELVRef& rhs) const {
66 return ( (index() < rhs.index()) ||
67 ( (index() == rhs.index()) && (dataID() < rhs.dataID()) ) );
68 }
69
70
72 bool toPersistent(const ElemLinkVec& owner);
73 bool toPersistent(const ElemLinkVec& owner,
74 typename DataLinkVector::size_type& shortref);
75 bool toTransient(const ElemLinkVec& owner);
76 bool doRemap();
77
78 const stored_index_type& index() const
79 {
80 return m_index;
81 }
82
83 private:
84
85 //Transient members only.
87
88 // Persistent members:
89 typename DataLinkVector::size_type m_shortRef;
90
92 };
93}
94#endif // not ATHLINKS_TOOLS_SGELVREF_H
ElementLinkVector implementation for standalone ROOT.
ID_type dataID() const
dataID of the host
ElemLink m_link
Definition SGELVRef.h:86
ElemLink::ID_type ID_type
Definition SGELVRef.h:38
bool operator==(const ELVRef &rhs) const
Definition SGELVRef.h:62
ElementLinkVector< DOBJ > ElemLinkVec
Definition SGELVRef.h:32
stored_index_type m_index
! index of the host dobj
Definition SGELVRef.h:91
const stored_index_type & index() const
Definition SGELVRef.h:78
ElementConstPointer cptr() const
element pointer in ElementLink
Definition SGELVRef.h:55
DataLinkVector::size_type m_shortRef
! the element pointer
Definition SGELVRef.h:89
ElemLink::IndexingPolicy IndexingPolicy
Definition SGELVRef.h:34
ELVRef(typename DataLinkVector::size_type hostIndex, index_type elementIndex, const ElemLinkVec &owner)
Constructor from indices.
ELVRef & operator=(const ELVRef &rhs)
STL required.
ElemLink::ElementConstPointer ElementConstPointer
Definition SGELVRef.h:35
const ElemLink & elementLink() const
get the corresponding ElementLink. O(1)
Definition SGELVRef.h:58
index_type elementIndex() const
index into container (non-const, calculates and sets on demand):
ELVRef(const ELVRef &rhs)
STL required.
bool toPersistent(const ElemLinkVec &owner)
called by handlers to change state:
ElemLink::index_type index_type
Definition SGELVRef.h:36
std::vector< DataLink< DOBJ > > DataLinkVector
Definition SGELVRef.h:31
ElementLink< DOBJ > ElemLink
Definition SGELVRef.h:33
bool toPersistent(const ElemLinkVec &owner, typename DataLinkVector::size_type &shortref)
ElemLink::stored_index_type stored_index_type
Definition SGELVRef.h:37
bool toTransient(const ElemLinkVec &owner)
ELVRef(const ElemLink &link=ElemLink())
standard constructor
bool doRemap()
bool operator<(const ELVRef &rhs) const
Definition SGELVRef.h:65
Forward declaration.
pointer & link(pointer p) const
Return a reference to the link for an element.
Definition index.py:1