DPsim
|
#include <Attribute.h>
Public Types | |
using | Type = T |
using | Ptr = AttributePointer< Attribute< T > > |
Public Types inherited from CPS::AttributeBase | |
typedef AttributePointer< AttributeBase > | Ptr |
typedef std::vector< Ptr > | List |
typedef std::set< Ptr, AttributeCmp< AttributeBase > > | Set |
typedef std::map< String, Ptr > | Map |
Public Member Functions | |
Attribute (T initialValue=T()) | |
virtual void | set (T value)=0 |
virtual T & | get ()=0 |
virtual void | setReference (Attribute< T >::Ptr reference)=0 |
virtual std::shared_ptr< T > | asRawPointer ()=0 |
String | toString () override |
Fallback method for all attribute types not covered by the specifications in Attribute.cpp. | |
operator const T & () | |
User-defined cast operator. More... | |
T & | operator* () |
User-defined dereference operator. More... | |
bool | copyValue (AttributeBase::Ptr copyFrom) override |
Copy the attribute value of copyFrom onto this attribute. More... | |
const std::type_info & | getType () override |
Get the type of this attribute. More... | |
AttributeBase::Ptr | cloneValueOntoNewAttribute () override |
Generates a new attribute of the same type and copies the current value in the heap. Does not copy any dependency relations! More... | |
template<class U > | |
Attribute< U >::Ptr | derive (typename AttributeUpdateTask< U, T >::Actor getter=typename AttributeUpdateTask< U, T >::Actor(), typename AttributeUpdateTask< U, T >::Actor setter=typename AttributeUpdateTask< U, T >::Actor()) |
template<typename U = T, std::enable_if_t< std::is_same_v< Complex, U >, bool > = true> | |
AttributePointer< Attribute< Real > > | deriveReal () |
template<typename U = T, std::enable_if_t< std::is_same_v< Complex, U >, bool > = true> | |
AttributePointer< Attribute< Real > > | deriveImag () |
template<typename U = T, std::enable_if_t< std::is_same_v< Complex, U >, bool > = true> | |
AttributePointer< Attribute< Real > > | deriveMag () |
template<typename U = T, std::enable_if_t< std::is_same_v< Complex, U >, bool > = true> | |
AttributePointer< Attribute< Real > > | derivePhase () |
template<typename U = T, std::enable_if_t< std::is_same_v< Real, U >||std::is_same_v< Complex, U >, bool > = true> | |
AttributePointer< Attribute< T > > | deriveScaled (T scale) |
template<class U , class V = T, std::enable_if_t< std::is_same_v< CPS::MatrixVar< U >, V >, bool > = true> | |
AttributePointer< Attribute< U > > | deriveCoeff (typename CPS::MatrixVar< U >::Index row, typename CPS::MatrixVar< U >::Index column) |
String | toString () |
String | toString () |
String | toString () |
Public Member Functions inherited from CPS::AttributeBase | |
virtual bool | isStatic () const =0 |
virtual void | appendDependencies (AttributeBase::Set *deps)=0 |
virtual AttributeBase::Set | getDependencies () final |
Protected Attributes | |
std::shared_ptr< T > | mData |
Main Attribute class. The template class T
holds the attribute's type. This is used as the type for all attribute member variables.
T | The type of this attribute |
Definition at line 266 of file Attribute.h.
|
pure virtual |
Exposing the underlying shared_ptr for this attribute's data. Used to create reference relations between two attributes.
Implemented in CPS::AttributeDynamic< T >, and CPS::AttributeStatic< T >.
|
inlineoverridevirtual |
Generates a new attribute of the same type and copies the current value in the heap. Does not copy any dependency relations!
Implements CPS::AttributeBase.
Definition at line 353 of file Attribute.h.
|
inlineoverridevirtual |
Copy the attribute value of copyFrom
onto this attribute.
Implements CPS::AttributeBase.
Definition at line 333 of file Attribute.h.
|
inline |
General method for deriving a new attribute from this attribute. Custom getter and setter functions have to be provided. The newly created attribute will only depend on this attribute in a 1:1 relationship.
U | The type of the newly derived attribute |
getter | The getter actor function to use for updating the derived attribute |
setter | The setter actor function for updating this when the derived attribute is changed |
U
which will calculate its value using the provided getter and update this
on changes using the provided setter Definition at line 368 of file Attribute.h.
|
inline |
Convenience method for deriving an attribute which covers one coefficient of this matrix
U | The type of the coefficient (usally Real or Complex) |
row | The coefficients row coordinate |
column | The coefficients column coordinate |
this(row, column)
Definition at line 516 of file Attribute.h.
|
inline |
Convenience method for deriving the imaginary part of a complex attribute
this
Definition at line 420 of file Attribute.h.
|
inline |
Convenience method for deriving the magnitude of a complex attribute
this
Definition at line 444 of file Attribute.h.
|
inline |
Convenience method for deriving the phase of a complex attribute
this
Definition at line 467 of file Attribute.h.
|
inline |
Convenience method for deriving the real part of a complex attribute
this
Definition at line 396 of file Attribute.h.
|
inline |
Convenience method for deriving an attribute whose value is always scaled by scale
scale | The scaling to apply to the attribute's value |
this
but scaled by scale
Definition at line 492 of file Attribute.h.
|
pure virtual |
Get a mutable reference to the attribute's underlying data. This method is also called when dereferencing an attribute using the * operator
Implemented in CPS::AttributeDynamic< T >, and CPS::AttributeStatic< T >.
|
inlineoverridevirtual |
Get the type of this attribute.
Implements CPS::AttributeBase.
Definition at line 347 of file Attribute.h.
|
inline |
User-defined cast operator.
Allows attributes to be casted to their value type:
Real v = 1.2; auto a = Attribute<Real>(&v);
Real x = v;
Definition at line 322 of file Attribute.h.
|
inline |
User-defined dereference operator.
Allows easier access to the attribute's underlying data
Definition at line 327 of file Attribute.h.
|
pure virtual |
Manually set the attribute to the given value. For dynamic attributes, this will trigger the UPDATE_ON_SET tasks for updating any dependency attributes.
Implemented in CPS::AttributeDynamic< T >, and CPS::AttributeStatic< T >.
|
pure virtual |
Convenience method for setting this attribute to always equal another attribute. When this
is dynamic, this will set up an UPDATE_ONCE task that sets this attribute's data pointer to equal the data pointer of the referenced attribute. If this
is static, calling this method will result in a runtime error.
reference | The attribute which's value will be adapted |
Implemented in CPS::AttributeDynamic< T >, and CPS::AttributeStatic< T >.
|
virtual |
Display this attribute's value as a string
Implements CPS::AttributeBase.
|
virtual |
Display this attribute's value as a string
Implements CPS::AttributeBase.
|
virtual |
Display this attribute's value as a string
Implements CPS::AttributeBase.