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

#include <ProxyContainer.h>

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

Classes

struct  diff_type_helper

Public Types

using BASE = ProxyIteratorBase<Container,T_Derived, ElementProxy>
using value_type = decltype( std::declval<BASE>().operator *())
using difference_type
using element_index_t = typename ElementProxy::index_t
using index_t
using ContainerNonConst
using ContainerPtr

Public Member Functions

 ProxyIterator ()
ProxyIteratoroperator++ ()
ProxyIteratoroperator+= (std::size_t offset)
ProxyIterator operator++ (int)
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
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::ProxyIterator< Container, T_Derived, ElementProxy >

Definition at line 290 of file ProxyContainer.h.

Member Typedef Documentation

◆ BASE

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

Definition at line 292 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.

◆ difference_type

template<class Container, class T_Derived, class ElementProxy>
using Utils::ProxyIterator< Container, T_Derived, ElementProxy >::difference_type
Initial value:
decltype( diff_type_helper<typename BASE::element_index_t>::diff(std::declval<typename BASE::element_index_t>(),
std::declval<typename BASE::element_index_t>()) )
static std::int64_t diff(const T &a, const T &b)

Definition at line 344 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
inherited

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.

◆ value_type

template<class Container, class T_Derived, class ElementProxy>
using Utils::ProxyIterator< Container, T_Derived, ElementProxy >::value_type = decltype( std::declval<BASE>().operator *())

Definition at line 322 of file ProxyContainer.h.

Constructor & Destructor Documentation

◆ ProxyIterator()

template<class Container, class T_Derived, class ElementProxy>
Utils::ProxyIterator< Container, T_Derived, ElementProxy >::ProxyIterator ( )
inline

Definition at line 296 of file ProxyContainer.h.

296: BASE(nullptr,typename BASE::element_index_t{}) {}
ProxyIteratorBase< Container, T_Derived, ElementProxy > BASE

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 )
inlinestaticinherited

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 )
inlinestaticinherited

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 )
inlinestaticinherited

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>
template<class OtherContainer>
requires (std::is_same_v<typename BASE::ContainerNonConst, typename ProxyIteratorBase<OtherContainer, T_Derived, ElementProxy>::ContainerNonConst>)
bool Utils::ProxyIterator< Container, T_Derived, ElementProxy >::operator!= ( const ProxyIteratorBase< OtherContainer, T_Derived, ElementProxy > & other) const
inline

Definition at line 315 of file ProxyContainer.h.

317 {
318 return !(this->operator==(other));
319 }
bool operator==(const ProxyIteratorBase< OtherContainer, T_Derived, ElementProxy > &other) const

◆ operator*()

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

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++() [1/2]

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

Definition at line 298 of file ProxyContainer.h.

298 {
299 (void) BASE::operator++();
300 return *this;
301 }

◆ operator++() [2/2]

template<class Container, class T_Derived, class ElementProxy>
ProxyIterator Utils::ProxyIterator< Container, T_Derived, ElementProxy >::operator++ ( int )
inline

Definition at line 308 of file ProxyContainer.h.

308 {
309 ProxyIterator clone(*this);
311 return clone;
312 }

◆ operator+=()

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

Definition at line 302 of file ProxyContainer.h.

302 {
304 return *this;
305 }

◆ 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
inlineinherited

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: