ATLAS Offline Software
|
Proxy for lvalue access to DataVector/
.
More...DataList
elements
#include <ElementProxy.h>
Public Types | |
typedef ROOT_SELECTION_NS::DataModel_detail::ElementProxy< DVL >::self | self |
typedef ElementProxy< DVL > | self |
Public Member Functions | |
ElementProxy (typename DVL::BaseContainer::iterator i, DVL *container) | |
Constructor. More... | |
ElementProxy (const ElementProxy &)=default | |
Default copy. More... | |
ElementProxy & | operator= (const ElementProxy &rhs) |
Assignment operator, from an Element proxy. More... | |
operator= (typename DVL::value_type rhs) | |
Assignment operator, from a pointer. More... | |
ElementProxy & | operator= (typename DVL::unique_type rhs) |
Assignment operator, from a unique_ptr. More... | |
operator typename DVL::value_type const () const | |
Conversion to a (const) pointer. More... | |
DVL::value_type const | operator-> () const |
Conversion to a (const) pointer. More... | |
DVL * | container () |
Return the container holding the element that this object proxies. More... | |
const DVL * | container () const |
Return the container holding the element that this object proxies. More... | |
Public Attributes | |
ROOT_SELECTION_NS::MemberAttributes< kTransient > | m_proxied |
ROOT_SELECTION_NS::MemberAttributes< kTransient > | m_container |
Private Attributes | |
DVL::BaseContainer::iterator | m_proxied |
Iterator pointing at the proxied element. More... | |
DVL * | m_container |
The container that it references. More... | |
Proxy for lvalue access to DataVector/
. DataList
elements
We need to be careful with lvalue references to DataVector/List
elements. If the DataVector/List
owns its elements, then if we write into the DataVector/List
via an lvalue, the old element should be deleted (and the DataVector/List
then takes ownership of the new value). We implement this by having the lvalue references return a proxy object rather than a raw reference. The proxy handles ownership issues. To do this, the proxy stores a pointer to the original container.
When inheritance is used with DataVector/List
, we have the additional restriction that we can only write into the DataVector/List
using the most-derived DataVector/List
class. We also need to enforce that in ElementProxy
when there's an attempt to write via an lvalue. We can also get this information from the original container.
Definition at line 26 of file ElementProxy.h.
typedef ROOT_SELECTION_NS::DataModel_detail::ElementProxy<DVL>::self DataModel_detail::ElementProxy< DVL >::self |
Definition at line 143 of file ElementProxy.h.
typedef ElementProxy<DVL> DataModel_detail::ElementProxy< DVL >::self |
Definition at line 165 of file ElementProxy.h.
DataModel_detail::ElementProxy< DVL >::ElementProxy | ( | typename DVL::BaseContainer::iterator | i, |
DVL * | container | ||
) |
Constructor.
i | The underlying container iterator pointing at the element which we're proxying. |
container | The container that the iterator references. |
|
default |
Default copy.
DVL* DataModel_detail::ElementProxy< DVL >::container | ( | ) |
Return the container holding the element that this object proxies.
const DVL* DataModel_detail::ElementProxy< DVL >::container | ( | ) | const |
Return the container holding the element that this object proxies.
DataModel_detail::ElementProxy< DVL >::operator typename DVL::value_type const | ( | ) | const |
Conversion to a (const) pointer.
We just need to do a cast here.
DVL::value_type const DataModel_detail::ElementProxy< DVL >::operator-> | ( | ) | const |
Conversion to a (const) pointer.
We just need to do a cast here.
ElementProxy& DataModel_detail::ElementProxy< DVL >::operator= | ( | const ElementProxy< DVL > & | rhs | ) |
Assignment operator, from an Element
proxy.
rhs | The proxy from which we're assigning. |
If rhs is the same as the element we're proxying, then we don't need to do anything. Otherwise, can_insert
must be true. If the parent DataVector/List
owns its elements, we then need to delete the proxied object before making the assignment. We also disallow copying between two DataVector/List's
, both of which own their elements.
ElementProxy& DataModel_detail::ElementProxy< DVL >::operator= | ( | typename DVL::unique_type | rhs | ) |
Assignment operator, from a unique_ptr.
rhs | The pointer from which we're assigning. |
If rhs is the same as the element we're proxying, then we don't need to do anything. Otherwise, can_insert
must be true. The container must own its elements in order to use this interface.
DataModel_detail::ElementProxy< DVL >::operator= | ( | typename DVL::value_type | rhs | ) |
Assignment operator, from a pointer.
rhs | The pointer from which we're assigning. |
If rhs is the same as the element we're proxying, then we don't need to do anything. Otherwise, can_insert
must be true. If the parent DataVector/List
owns its elements, we then need to delete the proxied object before making the assignment.
|
private |
The container that it references.
Definition at line 151 of file ElementProxy.h.
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataModel_detail::ElementProxy< DVL >::m_container |
Definition at line 167 of file ElementProxy.h.
|
private |
Iterator pointing at the proxied element.
Definition at line 148 of file ElementProxy.h.
ROOT_SELECTION_NS::MemberAttributes< kTransient > DataModel_detail::ElementProxy< DVL >::m_proxied |
Definition at line 166 of file ElementProxy.h.