ArmNN
 25.11
Loading...
Searching...
No Matches
OptionalReferenceSwitch< IsReference, T > Class Template Reference

The default implementation is the non-reference case. More...

#include <Optional.hpp>

Inheritance diagram for OptionalReferenceSwitch< IsReference, T >:
[legend]
Collaboration diagram for OptionalReferenceSwitch< IsReference, T >:
[legend]

Public Types

using Base = OptionalBase

Public Member Functions

 OptionalReferenceSwitch () noexcept
 OptionalReferenceSwitch (EmptyOptional) noexcept
 OptionalReferenceSwitch (const T &value)
template<class... Args>
 OptionalReferenceSwitch (ConstructInPlace, Args &&... args)
 OptionalReferenceSwitch (const OptionalReferenceSwitch &other)
OptionalReferenceSwitchoperator= (const T &value)
OptionalReferenceSwitchoperator= (const OptionalReferenceSwitch &other)
OptionalReferenceSwitchoperator= (EmptyOptional)
 ~OptionalReferenceSwitch ()
void reset ()
const T & value () const
T & value ()
Public Member Functions inherited from OptionalBase
 OptionalBase () noexcept
bool has_value () const noexcept
 operator bool () const noexcept
 Conversion to bool, so can be used in if-statements and similar contexts expecting a bool.

Additional Inherited Members

Protected Member Functions inherited from OptionalBase
 OptionalBase (bool hasValue) noexcept
Protected Attributes inherited from OptionalBase
bool m_HasValue

Detailed Description

template<bool IsReference, typename T>
class armnn::OptionalReferenceSwitch< IsReference, T >

The default implementation is the non-reference case.

This has an unsigned char array for storing the optional value which is in-place constructed there.

Definition at line 81 of file Optional.hpp.

Member Typedef Documentation

◆ Base

template<bool IsReference, typename T>
using Base = OptionalBase

Definition at line 84 of file Optional.hpp.

Constructor & Destructor Documentation

◆ OptionalReferenceSwitch() [1/5]

template<bool IsReference, typename T>
OptionalReferenceSwitch ( )
inlinenoexcept

Definition at line 86 of file Optional.hpp.

86: Base{} {}

◆ OptionalReferenceSwitch() [2/5]

template<bool IsReference, typename T>
OptionalReferenceSwitch ( EmptyOptional )
inlinenoexcept

Definition at line 87 of file Optional.hpp.

87: Base{} {}

◆ OptionalReferenceSwitch() [3/5]

template<bool IsReference, typename T>
OptionalReferenceSwitch ( const T & value)
inline

Definition at line 89 of file Optional.hpp.

90 : Base{}
91 {
92 Construct(value);
93 }

◆ OptionalReferenceSwitch() [4/5]

template<bool IsReference, typename T>
template<class... Args>
OptionalReferenceSwitch ( ConstructInPlace ,
Args &&... args )
inline

Definition at line 96 of file Optional.hpp.

97 : Base{}
98 {
99 Construct(CONSTRUCT_IN_PLACE, std::forward<Args>(args)...);
100 }
#define CONSTRUCT_IN_PLACE
Definition Optional.hpp:41

◆ OptionalReferenceSwitch() [5/5]

template<bool IsReference, typename T>
OptionalReferenceSwitch ( const OptionalReferenceSwitch< IsReference, T > & other)
inline

Definition at line 102 of file Optional.hpp.

103 : Base{}
104 {
105 *this = other;
106 }

◆ ~OptionalReferenceSwitch()

template<bool IsReference, typename T>
~OptionalReferenceSwitch ( )
inline

Definition at line 132 of file Optional.hpp.

133 {
134 reset();
135 }

Member Function Documentation

◆ operator=() [1/3]

template<bool IsReference, typename T>
OptionalReferenceSwitch & operator= ( const OptionalReferenceSwitch< IsReference, T > & other)
inline

Definition at line 115 of file Optional.hpp.

116 {
117 reset();
118 if (other.has_value())
119 {
120 Construct(other.value());
121 }
122
123 return *this;
124 }

◆ operator=() [2/3]

template<bool IsReference, typename T>
OptionalReferenceSwitch & operator= ( const T & value)
inline

Definition at line 108 of file Optional.hpp.

109 {
110 reset();
111 Construct(value);
112 return *this;
113 }

◆ operator=() [3/3]

template<bool IsReference, typename T>
OptionalReferenceSwitch & operator= ( EmptyOptional )
inline

Definition at line 126 of file Optional.hpp.

127 {
128 reset();
129 return *this;
130 }

◆ reset()

◆ value() [1/2]

template<bool IsReference, typename T>
T & value ( )
inline

Definition at line 157 of file Optional.hpp.

158 {
159 if (!Base::has_value())
160 {
161 throw BadOptionalAccessException("Optional has no value");
162 }
163
164 auto valuePtr = reinterpret_cast<T*>(m_Storage);
165 return *valuePtr;
166 }

◆ value() [2/2]

template<bool IsReference, typename T>
const T & value ( ) const
inline

Definition at line 146 of file Optional.hpp.

147 {
148 if (!Base::has_value())
149 {
150 throw BadOptionalAccessException("Optional has no value");
151 }
152
153 auto valuePtr = reinterpret_cast<const T*>(m_Storage);
154 return *valuePtr;
155 }

Referenced by ProfilingDetails::AddDetailsToString(), NetworkImpl::AddPrecompiledLayer(), NetworkImpl::AddTransposeConvolution2dLayer(), armnn::CheckSupportRule(), armnn::ClConvolution2dWorkloadValidate(), armnn::ClConvolution3dWorkloadValidate(), armnn::ClDepthwiseConvolutionWorkloadValidate(), armnn::ClFullyConnectedWorkloadValidate(), armnn::ClTransposeConvolution2dWorkloadValidate(), armnnOnnxParser::CreateConstTensorImpl(), armnn::ExtractJsonObjects(), armnn::GetBiasTypeFromWeightsType(), armnnUtils::GetPerAxisParams(), LayerSupportHandle::IsBroadcastToSupported(), LayerSupportHandle::IsConvolution2dSupported(), RefLayerSupport::IsConvolution2dSupported(), LayerSupportHandle::IsConvolution3dSupported(), RefLayerSupport::IsConvolution3dSupported(), LayerSupportHandle::IsDepthwiseConvolutionSupported(), RefLayerSupport::IsDepthwiseConvolutionSupported(), LayerSupportHandle::IsDilatedDepthwiseConvolutionSupported(), LayerSupportHandle::IsFullyConnectedSupported(), ClLayerSupport::IsLayerSupported(), NeonLayerSupport::IsLayerSupported(), RefLayerSupport::IsLayerSupported(), TosaRefLayerSupport::IsLayerSupported(), armnn::IsLayerTypeSupported(), LayerSupportBase::IsStandInSupported(), LayerSupportHandle::IsTransposeConvolution2dSupported(), RefLayerSupport::IsTransposeConvolution2dSupported(), armnn::NeonConvolution2dWorkloadValidate(), armnn::NeonConvolution3dWorkloadValidate(), armnn::NeonDepthwiseConvolutionWorkloadValidate(), armnn::NeonFullyConnectedWorkloadValidate(), armnn::NeonTransposeConvolution2dWorkloadValidate(), OptionalReferenceSwitch< std::is_reference< T >::value, T >::operator=(), Optional< T >::operator==(), OptionalReferenceSwitch< std::is_reference< T >::value, T >::reset(), armnn::SetValueChecked(), armnnUtils::ToFloatArray(), IBackendInternal::UseCustomMemoryAllocator(), Convolution2dQueueDescriptor::Validate(), Convolution3dQueueDescriptor::Validate(), DepthwiseConvolution2dQueueDescriptor::Validate(), and TransposeConvolution2dQueueDescriptor::Validate().


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