PLaSK library
Loading...
Searching...
No Matches
plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue Struct Reference

Implementation of one value provider class which holds value inside (in value field) and operator() return its held value. More...

#include <plask/provider/providerfor.hpp>

Inheritance diagram for plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue:
[legend]
Collaboration diagram for plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue:
[legend]

Public Types

typedef ValueType ProvidedType
 Type of provided value.
 
- Public Types inherited from plask::ProviderFor< PropertyT, SpaceT >
typedef PropertyT PropertyTag
 
typedef SpaceT SpaceType
 

Public Member Functions

void invalidate ()
 Reset value to be uninitialized.
 
bool hasValue () const
 Check if this has value / is initialized.
 
void ensureHasValue () const
 Throw NoValue exception if value is not initialized.
 
 WithValue (const ProvidedType &value)
 Construct value.
 
 WithValue (ProvidedType &&value)
 Construct value.
 
 WithValue ()
 Create empty plask::optional value.
 
WithValue & operator= (const ValueType &v)
 Set new value.
 
ProvidedType operator() (_ExtraParams...) const override
 Get provided value.
 
- Public Member Functions inherited from plask::ProviderFor< PropertyT, SpaceT >
 ProviderFor (Args &&... params)
 Delegate all constructors to parent class.
 

Public Attributes

plask::optional< ProvidedTypevalue
 Provided value.
 

Detailed Description

template<typename PropertyT, typename SpaceT, typename... _ExtraParams>
struct plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue

Implementation of one value provider class which holds value inside (in value field) and operator() return its held value.

Its value is optional and can throw exception if value was not assigned before requesting it.

It ignores extra parameters.

Definition at line 704 of file providerfor.hpp.

Member Typedef Documentation

◆ ProvidedType

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
typedef ValueType plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::ProvidedType

Type of provided value.

Definition at line 707 of file providerfor.hpp.

Constructor & Destructor Documentation

◆ WithValue() [1/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::WithValue ( const ProvidedType value)
inline

Construct value.

Definition at line 727 of file providerfor.hpp.

◆ WithValue() [2/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::WithValue ( ProvidedType &&  value)
inline

Construct value.

Definition at line 730 of file providerfor.hpp.

◆ WithValue() [3/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::WithValue ( )
inline

Create empty plask::optional value.

Definition at line 733 of file providerfor.hpp.

Member Function Documentation

◆ ensureHasValue()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
void plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::ensureHasValue ( ) const
inline

Throw NoValue exception if value is not initialized.

Definition at line 722 of file providerfor.hpp.

◆ hasValue()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
bool plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::hasValue ( ) const
inline

Check if this has value / is initialized.

Returns
true only if this is initialized (has value)

Definition at line 719 of file providerfor.hpp.

◆ invalidate()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
void plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::invalidate ( )
inline

Reset value to be uninitialized.

Definition at line 713 of file providerfor.hpp.

◆ operator()()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
ProvidedType plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::operator() ( _ExtraParams...  ) const
inlineoverride

Get provided value.

Returns
provided value
Exceptions
NoValueif value is empty plask::optional

Definition at line 750 of file providerfor.hpp.

◆ operator=()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
WithValue & plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::operator= ( const ValueType v)
inline

Set new value.

Parameters
vnew value
Returns
*this

Definition at line 740 of file providerfor.hpp.

Member Data Documentation

◆ value

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
plask::optional<ProvidedType> plask::ProviderImpl< PropertyT, SINGLE_VALUE_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue::value

Provided value.

Definition at line 710 of file providerfor.hpp.


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