ATLAS Offline Software
Loading...
Searching...
No Matches
Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy > Struct Template Reference

Base class of iterators to iterate over the elements of this proxy container. More...

#include <ProxyContainer.h>

Inheritance diagram for Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >:
Collaboration diagram for Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >:

Public Types

using element_index_t = typename ElementProxy::index_t
using BASE = ElementProxyBase<Container, element_index_t>
using index_t
using ContainerNonConst
using ContainerPtr

Public Member Functions

ProxyIteratorBaseoperator++ ()
ProxyIteratorBaseoperator+= (std::size_t offset)
auto operator* ()
template<class OtherContainer>
requires (std::is_same_v<typename BASE::ContainerNonConst, typename ProxyIteratorBase<OtherContainer, T_Derived, ElementProxy>::ContainerNonConst>)
bool operator== (const ProxyIteratorBase< OtherContainer, T_Derived, ElementProxy > &other) const
index_t index () const
const ContainerNonConstcontainer () const

Static Public Member Functions

static auto createElementProxy (const BASE::ContainerNonConst *ptr, element_index_t &&element_index)
 Create a proxy for one element of the "container" this proxy represents (read-only access).
static auto createElementProxy (const BASE::ContainerNonConst *ptr, element_index_t &&element_index)
 Create a proxy for one element of the "container" this proxy represents (read-only access).
static auto createElementProxy (BASE::ContainerNonConst *ptr, element_index_t &&element_index)
 Create a proxy for one element of the "container" this proxy represents (read-write access).

Static Public Attributes

static constexpr bool isConst

Protected Member Functions

const ContainerNonConstcptr () const

Protected Attributes

ContainerPtr m_container
index_t m_index

Detailed Description

template<class Container, class T_Derived, class ElementProxy>
struct Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >

Base class of iterators to iterate over the elements of this proxy container.

Definition at line 212 of file ProxyContainer.h.

Member Typedef Documentation

◆ BASE

template<class Container, class T_Derived, class ElementProxy>
using Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::BASE = ElementProxyBase<Container, element_index_t>

Definition at line 214 of file ProxyContainer.h.

◆ ContainerNonConst

using Utils::ElementProxyBase< Container, ElementProxy::index_t >::ContainerNonConst
inherited

Definition at line 116 of file ProxyContainer.h.

◆ ContainerPtr

using Utils::ElementProxyBase< Container, ElementProxy::index_t >::ContainerPtr
inherited

Definition at line 117 of file ProxyContainer.h.

◆ element_index_t

template<class Container, class T_Derived, class ElementProxy>
using Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::element_index_t = typename ElementProxy::index_t

Definition at line 213 of file ProxyContainer.h.

◆ index_t

using Utils::ElementProxyBase< Container, ElementProxy::index_t >::index_t
inherited

Definition at line 115 of file ProxyContainer.h.

Member Function Documentation

◆ container()

const ContainerNonConst & Utils::ElementProxyBase< Container, ElementProxy::index_t >::container ( ) const
inlineinherited
Returns
A const pointer of the container which contains the elements this proxy refers to. The value returned by index identifies the element within this container.

Definition at line 152 of file ProxyContainer.h.

◆ cptr()

const ContainerNonConst * Utils::ElementProxyBase< Container, ElementProxy::index_t >::cptr ( ) const
inlineprotectedinherited

Definition at line 159 of file ProxyContainer.h.

159 {
160 return &container();
161 }

◆ createElementProxy() [1/3]

template<class Container, class T_Derived, class ElementProxy>
auto Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::createElementProxy ( BASE::ContainerNonConst * ptr,
element_index_t && element_index )
inlinestatic

Create a proxy for one element of the "container" this proxy represents (read-write access).

Parameters
ptrA pointer to the container which contains the element data
element_indexAn index which identifies the element in the given container.
Returns
A new proxy which represents the specified element.

Definition at line 274 of file ProxyContainer.h.

275 {
276 if constexpr(hasCreateProxy<ElementProxy, decltype(ptr), element_index_t> ) {
278 }
279 else {
281 }
282 }
Base class of iterators to iterate over the elements of this proxy container.
typename ElementProxy::index_t element_index_t

◆ createElementProxy() [2/3]

template<class Container, class T_Derived, class ElementProxy>
auto Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::createElementProxy ( const BASE::ContainerNonConst * ptr,
element_index_t && element_index )
inlinestatic

Create a proxy for one element of the "container" this proxy represents (read-only access).

Parameters
ptrA pointer to the container which contains the element data
element_indexAn index which identifies the element in the given container.
Returns
A new proxy which represents the specified element. This method will be called if the element proxy provides a create method.
Note
to create a const element proxy from a non-const element proxy requires that the element proxy provides a create method which takes a const contaner as argument.

Definition at line 252 of file ProxyContainer.h.

254 {
256 }

◆ createElementProxy() [3/3]

template<class Container, class T_Derived, class ElementProxy>
auto Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::createElementProxy ( const BASE::ContainerNonConst * ptr,
element_index_t && element_index )
inlinestatic

Create a proxy for one element of the "container" this proxy represents (read-only access).

Parameters
ptrA pointer to the container which contains the element data
element_indexAn index which identifies the element in the given container.
Returns
A new proxy which represents the specified element. This method will be called if the element proxy does not provide a create method. In this case the const-ness of the element proxy will be inherited from the parent proxy.

Definition at line 264 of file ProxyContainer.h.

266 {
268 }

◆ index()

index_t Utils::ElementProxyBase< Container, ElementProxy::index_t >::index ( ) const
inlineinherited
Parameters
Returnthe "index" which identifies the element this proxy refers to within the container returned by container. This may or may not be the index which was used to create this proxy from the parent proxy i.e. in auto child_proxy=parent_proxy[index] it may be that child_proxy.index() != index. To recover "index" use auto index_recover = ParentProxy::getOriginalElementIndex(child_proxy);

Definition at line 148 of file ProxyContainer.h.

148{ return m_index; }

◆ operator*()

template<class Container, class T_Derived, class ElementProxy>
auto Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::operator* ( )
inline

Definition at line 228 of file ProxyContainer.h.

229 {
230 return this->createElementProxy(this->m_container,
231 typename BASE::index_t(this->m_index));
232 }
static auto createElementProxy(const BASE::ContainerNonConst *ptr, element_index_t &&element_index)
Create a proxy for one element of the "container" this proxy represents (read-only access).

◆ operator++()

template<class Container, class T_Derived, class ElementProxy>
ProxyIteratorBase & Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::operator++ ( )
inline

Definition at line 218 of file ProxyContainer.h.

218 {
220 return *this;
221 }

◆ operator+=()

template<class Container, class T_Derived, class ElementProxy>
ProxyIteratorBase & Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::operator+= ( std::size_t offset)
inline

Definition at line 222 of file ProxyContainer.h.

222 {
223 this->m_index = this->m_index + offset;
224 return *this;
225 }

◆ operator==()

template<class Container, class T_Derived, class ElementProxy>
template<class OtherContainer>
requires (std::is_same_v<typename BASE::ContainerNonConst, typename ProxyIteratorBase<OtherContainer, T_Derived, ElementProxy>::ContainerNonConst>)
bool Utils::ProxyIteratorBase< Container, T_Derived, ElementProxy >::operator== ( const ProxyIteratorBase< OtherContainer, T_Derived, ElementProxy > & other) const
inline

Definition at line 237 of file ProxyContainer.h.

240 {
242 return this->m_index == other.m_index;
243 }

Member Data Documentation

◆ isConst

bool Utils::ElementProxyBase< Container, ElementProxy::index_t >::isConst
staticconstexprinherited

Definition at line 114 of file ProxyContainer.h.

◆ m_container

ContainerPtr Utils::ElementProxyBase< Container, ElementProxy::index_t >::m_container
protectedinherited

Definition at line 162 of file ProxyContainer.h.

◆ m_index

index_t Utils::ElementProxyBase< Container, ElementProxy::index_t >::m_index
protectedinherited

Definition at line 163 of file ProxyContainer.h.


The documentation for this struct was generated from the following file: