ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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. More...
 

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

using Base = OptionalBase

Definition at line 84 of file Optional.hpp.

Constructor & Destructor Documentation

◆ OptionalReferenceSwitch() [1/5]

OptionalReferenceSwitch ( )
inlinenoexcept

Definition at line 86 of file Optional.hpp.

86 : Base{} {}

◆ OptionalReferenceSwitch() [2/5]

OptionalReferenceSwitch ( EmptyOptional  )
inlinenoexcept

Definition at line 87 of file Optional.hpp.

87 : Base{} {}

◆ OptionalReferenceSwitch() [3/5]

OptionalReferenceSwitch ( const T &  value)
inline

Definition at line 89 of file Optional.hpp.

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

References OptionalReferenceSwitch< IsReference, T >::value().

◆ OptionalReferenceSwitch() [4/5]

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

References CONSTRUCT_IN_PLACE.

◆ OptionalReferenceSwitch() [5/5]

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

Definition at line 102 of file Optional.hpp.

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

◆ ~OptionalReferenceSwitch()

Definition at line 132 of file Optional.hpp.

133  {
134  reset();
135  }

References OptionalReferenceSwitch< IsReference, T >::reset().

Member Function Documentation

◆ operator=() [1/3]

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  }

References OptionalBase::has_value(), OptionalReferenceSwitch< IsReference, T >::reset(), and OptionalReferenceSwitch< IsReference, T >::value().

◆ operator=() [2/3]

OptionalReferenceSwitch& operator= ( const T &  value)
inline

Definition at line 108 of file Optional.hpp.

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

References OptionalReferenceSwitch< IsReference, T >::reset(), and OptionalReferenceSwitch< IsReference, T >::value().

◆ operator=() [3/3]

OptionalReferenceSwitch& operator= ( EmptyOptional  )
inline

Definition at line 126 of file Optional.hpp.

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

References OptionalReferenceSwitch< IsReference, T >::reset().

◆ reset()

◆ value() [1/2]

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  }

References OptionalBase::has_value().

◆ value() [2/2]

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  }

References OptionalBase::has_value().

Referenced by ProfilingDetails::AddDetailsToString(), NetworkImpl::AddPrecompiledLayer(), NetworkImpl::AddTransposeConvolution2dLayer(), armnn::CheckSupportRule(), armnnOnnxParser::CreateConstTensorImpl(), BackendRegistry::Deregister(), armnn::ExtractJsonObjects(), armnn::GetBiasTypeFromWeightsType(), armnnUtils::GetPerAxisParams(), LayerSupportHandle::IsBroadcastToSupported(), LayerSupportHandle::IsConvolution2dSupported(), RefLayerSupport::IsConvolution2dSupported(), LayerSupportHandle::IsConvolution3dSupported(), RefLayerSupport::IsConvolution3dSupported(), LayerSupportHandle::IsDepthwiseConvolutionSupported(), RefLayerSupport::IsDepthwiseConvolutionSupported(), LayerSupportHandle::IsDilatedDepthwiseConvolutionSupported(), LayerSupportHandle::IsFullyConnectedSupported(), RefLayerSupport::IsLayerSupported(), TosaRefLayerSupport::IsLayerSupported(), ClLayerSupport::IsLayerSupported(), NeonLayerSupport::IsLayerSupported(), armnn::IsLayerTypeSupported(), LayerSupportBase::IsStandInSupported(), LayerSupportHandle::IsTransposeConvolution2dSupported(), RefLayerSupport::IsTransposeConvolution2dSupported(), OptionalReferenceSwitch< IsReference, T >::operator=(), OptionalReferenceSwitch< true, T >::operator=(), Optional< T >::operator==(), OptionalReferenceSwitch< IsReference, T >::OptionalReferenceSwitch(), BackendRegistry::Register(), OptionalReferenceSwitch< IsReference, 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: