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#include <boost/iterator_adaptors.hpp>
15
16
17
18template <typename DOBJ>
20
26
27namespace SG {
28 template <typename DOBJ>
29 class ELVRef
30 {
31 public:
32 typedef typename std::vector< DataLink<DOBJ> > DataLinkVector;
39 typedef typename ElemLink::ID_type ID_type;
40
42 ELVRef(const ELVRef& rhs);
44 ELVRef& operator=(const ELVRef& rhs);
46 ELVRef(const ElemLink& link=ElemLink());
48 ELVRef(typename DataLinkVector::size_type hostIndex,
50 const ElemLinkVec& owner);
52 ID_type dataID() const;
56 ElementConstPointer cptr() const { return m_link.cptr(); }
57
59 const ElemLink& elementLink() const { return m_link; }
60
62
63 bool operator == (const ELVRef& rhs) const {
64 return ( (index() == rhs.index()) && (dataID() == rhs.dataID()) );
65 }
66 bool operator < (const ELVRef& rhs) const {
67 return ( (index() < rhs.index()) ||
68 ( (index() == rhs.index()) && (dataID() < rhs.dataID()) ) );
69 }
70
71
73 bool toPersistent(const ElemLinkVec& owner);
74 bool toPersistent(const ElemLinkVec& owner,
75 typename DataLinkVector::size_type& shortref);
76 bool toTransient(const ElemLinkVec& owner);
77 bool doRemap();
78
79 const stored_index_type& index() const
80 {
81 return m_index;
82 }
83
84 private:
85
86 //Transient members only.
88
89 // Persistent members:
90 typename DataLinkVector::size_type m_shortRef;
91
93 };
94}
95#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:87
ElemLink::ID_type ID_type
Definition SGELVRef.h:39
bool operator==(const ELVRef &rhs) const
Definition SGELVRef.h:63
ElementLinkVector< DOBJ > ElemLinkVec
Definition SGELVRef.h:33
stored_index_type m_index
! index of the host dobj
Definition SGELVRef.h:92
const stored_index_type & index() const
Definition SGELVRef.h:79
ElementConstPointer cptr() const
element pointer in ElementLink
Definition SGELVRef.h:56
DataLinkVector::size_type m_shortRef
! the element pointer
Definition SGELVRef.h:90
ElemLink::IndexingPolicy IndexingPolicy
Definition SGELVRef.h:35
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:36
const ElemLink & elementLink() const
get the corresponding ElementLink. O(1)
Definition SGELVRef.h:59
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:37
std::vector< DataLink< DOBJ > > DataLinkVector
Definition SGELVRef.h:32
ElementLink< DOBJ > ElemLink
Definition SGELVRef.h:34
bool toPersistent(const ElemLinkVec &owner, typename DataLinkVector::size_type &shortref)
ElemLink::stored_index_type stored_index_type
Definition SGELVRef.h:38
bool toTransient(const ElemLinkVec &owner)
ELVRef(const ElemLink &link=ElemLink())
standard constructor
bool doRemap()
bool operator<(const ELVRef &rhs) const
Definition SGELVRef.h:66
IndexingPolicy::stored_index_type stored_index_type
Forward declaration.
Definition index.py:1