PLaSK library
Loading...
Searching...
No Matches
plask::ReceiverFor< PropertyT, SpaceT > Struct Template Reference

Specializations of this class are implementations of Receiver for given property tag. More...

#include <plask/provider/providerfor.hpp>

Inheritance diagram for plask::ReceiverFor< PropertyT, SpaceT >:
[legend]
Collaboration diagram for plask::ReceiverFor< PropertyT, SpaceT >:
[legend]

Public Types

typedef PropertyT PropertyTag
 
typedef SpaceT SpaceType
 
typedef PropertyAt< PropertyT, SpaceT >::ValueType ValueType
 
- Public Types inherited from plask::Receiver< ProviderT >
typedef Receiver< ProviderTBase
 
typedef ProviderT ProviderType
 Type of the corresponding provider.
 
- Public Types inherited from plask::ReceiverBase
enum class  ChangeReason { REASON_DELETE , REASON_VALUE , REASON_PROVIDER }
 The reason of change of provider value. More...
 

Public Member Functions

ReceiverForoperator= (const ReceiverFor &)=delete
 
 ReceiverFor (const ReceiverFor &)=delete
 
 ReceiverFor ()=default
 
ReceiverFor< PropertyT, SpaceT > & operator= (const ValueType &v)
 Set provider for this to provider of constant.
 
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==SINGLE_VALUE_PROPERTY >::type setValue (Args &&... value)
 Set provider to internal provider of some value.
 
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY >::type setValue (const ValueType &value)
 Set provider to internal provider of some value.
 
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY >::type setValues (Args &&... value)
 Set provider to internal provider of some value.
 
template<typename MeshT , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==FIELD_PROPERTY||propertyType==MULTI_FIELD_PROPERTY >::type setValue (DataVector< const ValueType > data, shared_ptr< MeshT > mesh)
 Set provider to internal provider of given field.
 
template<typename Iterator , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type setValues (Iterator begin, Iterator end)
 Set provider to internal provider of constant field.
 
template<typename MeshT , typename Iterator , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type setValues (Iterator begin, Iterator end, shared_ptr< MeshT > mesh)
 Set provider to internal provider of given field.
 
template<typename MeshT , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type setValue (const std::vector< DataVector< const ValueType > > &data, shared_ptr< MeshT > mesh)
 Set provider to internal provider of given field.
 
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry3D >::value >::type setTransformedProvider (ProviderFor< PropertyT, Geometry2DCartesian > *provider)
 Attach provider for Geometry2DCartesian -> Geometry3D transform.
 
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry3D >::value >::type setTransformedProvider (ProviderFor< PropertyT, Geometry2DCylindrical > *provider)
 Attach provider for Geometry2DCylindrical -> Geometry3D transform.
 
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry2DCartesian >::value >::type setTransformedProvider (ProviderFor< PropertyT, Geometry3D > *provider)
 Attach provider for Geometry3D -> Geometry2DCartesian transform.
 
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry2DCylindrical >::value >::type setTransformedProvider (ProviderFor< PropertyT, Geometry3D > *provider)
 Attach provider for Geometry3D -> Geometry2DCylindrical transform.
 
template<PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY||propertyType==MULTI_FIELD_PROPERTY, size_t >::type size () const
 Return number of elements provided by provider.
 
- Public Member Functions inherited from plask::Receiver< ProviderT >
virtual const charproviderName () const
 
Receiveroperator= (const Receiver &)=delete
 
 Receiver (const Receiver &)=delete
 
 Receiver ()
 Construct Receiver without connected provider and with set changed flag.
 
virtual ~Receiver ()
 Destructor. Disconnect from provider.
 
void fireChanged (ChangeReason reason)
 Set change flag and call providerValueChanged with given reason.
 
void setProvider (ProviderT *provider, bool newProviderIsPrivate=false)
 Change provider.
 
void setProvider (ProviderT &provider)
 Change provider.
 
void setProvider (std::unique_ptr< ProviderT > &&provider)
 Change provider.
 
ProviderTgetProvider ()
 Current provider getter.
 
const ProviderTgetProvider () const
 Current provider getter.
 
bool hasProvider () const
 
void ensureHasProvider () const
 
template<typename ... Args>
auto operator() (const Args &... params) const -> decltype((*provider)(params...))
 Get value from provider using its operator().
 
template<typename ... Args>
auto optional (const Args &... params) const -> plask::optional< decltype((*provider)(params...))>
 Get value from provider using its operator().
 
template<typename ... ConstProviderConstructorArgs>
void setConstValue (ConstProviderConstructorArgs &&... constProviderConstructorArgs)
 Set provider for this to provider of constant.
 
template<typename ClassT , typename methodT >
boost::signals2::connection changedConnectMethod (ClassT *obj, methodT method, boost::signals2::connect_position at=boost::signals2::at_back)
 Connect a method to changed signal.
 
template<typename ClassT , typename methodT >
void changedDisconnectMethod (ClassT *obj, methodT method)
 Disconnect a method from changed signal.
 
- Public Member Functions inherited from plask::ReceiverBase
virtual ~ReceiverBase ()
 

Additional Inherited Members

- Public Attributes inherited from plask::Receiver< ProviderT >
boost::signals2::signal< void(ReceiverBase &src, ChangeReason reason)> providerValueChanged
 Signal called when provider value or provider was changed (called by onChange)
 
ProviderTprovider
 Pointer to connected provider. Can be nullptr if no provider is connected.
 
- Static Public Attributes inherited from plask::Receiver< ProviderT >
static constexpr const charPROVIDER_NAME = ProviderT::NAME
 Name of provider.
 
- Protected Member Functions inherited from plask::Receiver< ProviderT >
void beforeGetValue () const
 Check if value can be read and throw exception if not.
 
- Protected Attributes inherited from plask::Receiver< ProviderT >
bool _hasPrivateProvider
 Is true only if provider is private and will be deleted by this receiver.
 

Detailed Description

template<typename PropertyT, typename SpaceT = void>
struct plask::ReceiverFor< PropertyT, SpaceT >

Specializations of this class are implementations of Receiver for given property tag.

Template Parameters
PropertyTproperty tag class (describe physical property)
SpaceTtype of space, required (and allowed) only for fields properties

Definition at line 472 of file providerfor.hpp.

Member Typedef Documentation

◆ PropertyTag

Definition at line 477 of file providerfor.hpp.

◆ SpaceType

Definition at line 478 of file providerfor.hpp.

◆ ValueType

Definition at line 479 of file providerfor.hpp.

Constructor & Destructor Documentation

◆ ReceiverFor() [1/2]

template<typename PropertyT , typename SpaceT = void>
plask::ReceiverFor< PropertyT, SpaceT >::ReceiverFor ( const ReceiverFor< PropertyT, SpaceT > &  )
delete

◆ ReceiverFor() [2/2]

template<typename PropertyT , typename SpaceT = void>
plask::ReceiverFor< PropertyT, SpaceT >::ReceiverFor ( )
default

Member Function Documentation

◆ operator=() [1/2]

◆ operator=() [2/2]

Set provider for this to provider of constant.

Use ProviderT::ConstProviderType as provider of const type.

Parameters
vvalue which should be provided for this receiver
Returns
*this

Definition at line 488 of file providerfor.hpp.

◆ setTransformedProvider() [1/4]

template<typename PropertyT , typename SpaceT = void>
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry3D >::value >::type plask::ReceiverFor< PropertyT, SpaceT >::setTransformedProvider ( ProviderFor< PropertyT, Geometry2DCartesian > *  provider)
inline

Attach provider for Geometry2DCartesian -> Geometry3D transform.

Definition at line 580 of file providerfor.hpp.

◆ setTransformedProvider() [2/4]

template<typename PropertyT , typename SpaceT = void>
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry3D >::value >::type plask::ReceiverFor< PropertyT, SpaceT >::setTransformedProvider ( ProviderFor< PropertyT, Geometry2DCylindrical > *  provider)
inline

Attach provider for Geometry2DCylindrical -> Geometry3D transform.

Definition at line 589 of file providerfor.hpp.

◆ setTransformedProvider() [3/4]

template<typename PropertyT , typename SpaceT = void>
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry2DCartesian >::value >::type plask::ReceiverFor< PropertyT, SpaceT >::setTransformedProvider ( ProviderFor< PropertyT, Geometry3D > *  provider)
inline

Attach provider for Geometry3D -> Geometry2DCartesian transform.

Definition at line 598 of file providerfor.hpp.

◆ setTransformedProvider() [4/4]

template<typename PropertyT , typename SpaceT = void>
template<typename GeometryT = SpaceT>
std::enable_if< std::is_same< GeometryT, Geometry2DCylindrical >::value >::type plask::ReceiverFor< PropertyT, SpaceT >::setTransformedProvider ( ProviderFor< PropertyT, Geometry3D > *  provider)
inline

Attach provider for Geometry3D -> Geometry2DCylindrical transform.

Definition at line 607 of file providerfor.hpp.

◆ setValue() [1/4]

template<typename PropertyT , typename SpaceT = void>
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==SINGLE_VALUE_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValue ( Args &&...  value)
inline

Set provider to internal provider of some value.

Parameters
valuevalue to set

Definition at line 499 of file providerfor.hpp.

◆ setValue() [2/4]

template<typename PropertyT , typename SpaceT = void>
template<typename MeshT , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValue ( const std::vector< DataVector< const ValueType > > &  data,
shared_ptr< MeshT mesh 
)
inline

Set provider to internal provider of given field.

Parameters
datadata with field values in mesh points
meshmesh value

Definition at line 568 of file providerfor.hpp.

◆ setValue() [3/4]

template<typename PropertyT , typename SpaceT = void>
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValue ( const ValueType value)
inline

Set provider to internal provider of some value.

Parameters
valuevalue to set

Definition at line 509 of file providerfor.hpp.

◆ setValue() [4/4]

template<typename PropertyT , typename SpaceT = void>
template<typename MeshT , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==FIELD_PROPERTY||propertyType==MULTI_FIELD_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValue ( DataVector< const ValueType data,
shared_ptr< MeshT mesh 
)
inline

Set provider to internal provider of given field.

Parameters
datadata with field values in mesh points
meshmesh value

Definition at line 530 of file providerfor.hpp.

◆ setValues() [1/3]

template<typename PropertyT , typename SpaceT = void>
template<typename... Args, PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValues ( Args &&...  value)
inline

Set provider to internal provider of some value.

Parameters
valuevalue to set

Definition at line 519 of file providerfor.hpp.

◆ setValues() [2/3]

template<typename PropertyT , typename SpaceT = void>
template<typename Iterator , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValues ( Iterator  begin,
Iterator  end 
)
inline

Set provider to internal provider of constant field.

Parameters
datadata with field values in mesh points

Definition at line 542 of file providerfor.hpp.

◆ setValues() [3/3]

template<typename PropertyT , typename SpaceT = void>
template<typename MeshT , typename Iterator , PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_FIELD_PROPERTY >::type plask::ReceiverFor< PropertyT, SpaceT >::setValues ( Iterator  begin,
Iterator  end,
shared_ptr< MeshT mesh 
)
inline

Set provider to internal provider of given field.

Parameters
datadata with field values in mesh points
meshmesh value

Definition at line 553 of file providerfor.hpp.

◆ size()

template<typename PropertyT , typename SpaceT = void>
template<PropertyType propertyType = PropertyTag::propertyType>
std::enable_if< propertyType==MULTI_VALUE_PROPERTY||propertyType==MULTI_FIELD_PROPERTY, size_t >::type plask::ReceiverFor< PropertyT, SpaceT >::size ( ) const
inline

Return number of elements provided by provider.

Definition at line 616 of file providerfor.hpp.


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