ATLAS Offline Software
Loading...
Searching...
No Matches
Utils::ContainerProxyBase< Container, ElementIndexType > Struct Template Reference

Base class of a container proxy. More...

#include <ProxyContainer.h>

Inheritance diagram for Utils::ContainerProxyBase< Container, ElementIndexType >:
Collaboration diagram for Utils::ContainerProxyBase< Container, ElementIndexType >:

Public Types

using element_index_t = ElementIndexType
using ContainerNonConst = std::remove_cvref_t<Container>
using ContainerPtr = std::conditional<isConst , const ContainerNonConst *, ContainerNonConst *>::type

Public Member Functions

template<class OtherContainer>
requires (std::is_same_v<ContainerNonConst, typename OtherContainer::ContainerNonConst> || !OtherContainer::isConst)
 ContainerProxyBase (const ContainerProxyBase< OtherContainer, ElementIndexType > &a)
 ContainerProxyBase (const ContainerNonConst *container)
 ContainerProxyBase (ContainerNonConst *container)
const ContainerNonConstcontainer () const
 return a const pointer of the container which contains the elements this proxy refers to.
ContainerNonConstcontainer ()
 Return a non const pointer of the container which contains the elements this proxy refers to provided the access policy permits read-write access.

Static Public Attributes

static constexpr bool isConst = std::is_const_v<Container>

Protected Member Functions

const ContainerNonConstcptr () const
ContainerNonConstptr ()

Protected Attributes

ContainerPtr m_container

Detailed Description

template<class Container, typename ElementIndexType>
struct Utils::ContainerProxyBase< Container, ElementIndexType >

Base class of a container proxy.

Template Parameters
Containerthe container type this proxy refers to e.g. CellData
ElementIndexTypethe index type to refer to an element of the container proxy e.g. unsigned int, but it could be an object with associated data e.g. an index to the parent element or on index offset for its child elements The base class provides an access controlled pointer to the container this proxy is referring to.

Definition at line 174 of file ProxyContainer.h.

Member Typedef Documentation

◆ ContainerNonConst

template<class Container, typename ElementIndexType>
using Utils::ContainerProxyBase< Container, ElementIndexType >::ContainerNonConst = std::remove_cvref_t<Container>

Definition at line 177 of file ProxyContainer.h.

◆ ContainerPtr

template<class Container, typename ElementIndexType>
using Utils::ContainerProxyBase< Container, ElementIndexType >::ContainerPtr = std::conditional<isConst , const ContainerNonConst *, ContainerNonConst *>::type

Definition at line 178 of file ProxyContainer.h.

◆ element_index_t

template<class Container, typename ElementIndexType>
using Utils::ContainerProxyBase< Container, ElementIndexType >::element_index_t = ElementIndexType

Definition at line 176 of file ProxyContainer.h.

Constructor & Destructor Documentation

◆ ContainerProxyBase() [1/3]

template<class Container, typename ElementIndexType>
template<class OtherContainer>
requires (std::is_same_v<ContainerNonConst, typename OtherContainer::ContainerNonConst> || !OtherContainer::isConst)
Utils::ContainerProxyBase< Container, ElementIndexType >::ContainerProxyBase ( const ContainerProxyBase< OtherContainer, ElementIndexType > & a)
inline

Definition at line 181 of file ProxyContainer.h.

Base class of a container proxy.

◆ ContainerProxyBase() [2/3]

template<class Container, typename ElementIndexType>
Utils::ContainerProxyBase< Container, ElementIndexType >::ContainerProxyBase ( const ContainerNonConst * container)
inline

Definition at line 184 of file ProxyContainer.h.

185 : m_container(container) {} // creates a proxy which provides read-only access to its elements
const ContainerNonConst & container() const
return a const pointer of the container which contains the elements this proxy refers to.

◆ ContainerProxyBase() [3/3]

template<class Container, typename ElementIndexType>
Utils::ContainerProxyBase< Container, ElementIndexType >::ContainerProxyBase ( ContainerNonConst * container)
inline

Definition at line 186 of file ProxyContainer.h.

187 : m_container(container) {} // creates a proxy which provides read-write access to its elements

Member Function Documentation

◆ container() [1/2]

template<class Container, typename ElementIndexType>
ContainerNonConst & Utils::ContainerProxyBase< Container, ElementIndexType >::container ( )
inline

Return a non const pointer of the container which contains the elements this proxy refers to provided the access policy permits read-write access.

Definition at line 194 of file ProxyContainer.h.

195 { assert( m_container != nullptr); return *m_container; }

◆ container() [2/2]

template<class Container, typename ElementIndexType>
const ContainerNonConst & Utils::ContainerProxyBase< Container, ElementIndexType >::container ( ) const
inline

return a const pointer of the container which contains the elements this proxy refers to.

Definition at line 190 of file ProxyContainer.h.

191 { assert(m_container != nullptr); return *m_container; }

◆ cptr()

template<class Container, typename ElementIndexType>
const ContainerNonConst * Utils::ContainerProxyBase< Container, ElementIndexType >::cptr ( ) const
inlineprotected

Definition at line 198 of file ProxyContainer.h.

198 {
199 return m_container;
200 }

◆ ptr()

template<class Container, typename ElementIndexType>
ContainerNonConst * Utils::ContainerProxyBase< Container, ElementIndexType >::ptr ( )
inlineprotected

Definition at line 201 of file ProxyContainer.h.

201 {
202 return m_container;
203 }

Member Data Documentation

◆ isConst

template<class Container, typename ElementIndexType>
bool Utils::ContainerProxyBase< Container, ElementIndexType >::isConst = std::is_const_v<Container>
staticconstexpr

Definition at line 175 of file ProxyContainer.h.

◆ m_container

template<class Container, typename ElementIndexType>
ContainerPtr Utils::ContainerProxyBase< Container, ElementIndexType >::m_container
protected

Definition at line 205 of file ProxyContainer.h.


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