DPsim
|
#include <Attribute.h>
Public Member Functions | |
AttributeDynamic (T initialValue=T()) | |
void | addTask (UpdateTaskKind kind, typename AttributeUpdateTaskBase< T >::Ptr task) |
void | clearTasks (UpdateTaskKind kind) |
void | clearAllTasks () |
virtual void | setReference (typename Attribute< T >::Ptr reference) override |
virtual std::shared_ptr< T > | asRawPointer () override |
virtual void | set (T value) override |
virtual T & | get () override |
virtual bool | isStatic () const override |
virtual void | appendDependencies (AttributeBase::Set *deps) override |
![]() | |
Attribute (T initialValue=T()) | |
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 () |
![]() | |
virtual AttributeBase::Set | getDependencies () final |
Protected Attributes | |
std::vector< typename AttributeUpdateTaskBase< T >::Ptr > | updateTasksOnce |
std::vector< typename AttributeUpdateTaskBase< T >::Ptr > | updateTasksOnGet |
std::vector< typename AttributeUpdateTaskBase< T >::Ptr > | updateTasksOnSet |
![]() | |
std::shared_ptr< T > | mData |
Friends | |
class | SharedFactory< AttributeDynamic< T > > |
Additional Inherited Members | |
![]() | |
using | Type = T |
using | Ptr = AttributePointer< Attribute< T > > |
![]() | |
typedef AttributePointer< AttributeBase > | Ptr |
typedef std::vector< Ptr > | List |
typedef std::set< Ptr, AttributeCmp< AttributeBase > > | Set |
typedef std::map< String, Ptr > | Map |
![]() | |
static std::shared_ptr< AttributeDynamic< T > > | make (Args &&...args) |
Class for dynamic attributes. A dynamic attribute has an internal value which can be updated by update tasks.
Definition at line 570 of file Attribute.h.
|
inline |
Allows for adding a new update task to this attribute.
kind | The kind of update task |
task | The update task itself |
THISISBAD: This is probably not the right time to run this kind of task
Definition at line 587 of file Attribute.h.
|
inlineoverridevirtual |
Implementation for dynamic attributes.This will recursively collect all attributes this attribute depends on, either in the UPDATE_ONCE or the UPDATE_ON_GET tasks. This is done by performing a Depth-First-Search on the dependency graph where the task dependencies of each attribute are the outgoing edges. The deps
set contains all the nodes that have already been visited in the graph
Implements CPS::AttributeBase.
Definition at line 681 of file Attribute.h.
|
inlineoverridevirtual |
Exposing the underlying shared_ptr for this attribute's data. Used to create reference relations between two attributes.
Implements CPS::Attribute< T >.
Definition at line 653 of file Attribute.h.
|
inline |
Remove all update tasks from this attribute, regardless of their kind.
Definition at line 629 of file Attribute.h.
|
inline |
Removes all update tasks of a given kind from this attribute.
kind | The kind of tasks to remove |
Definition at line 610 of file Attribute.h.
|
inlineoverridevirtual |
Get a mutable reference to the attribute's underlying data. This method is also called when dereferencing an attribute using the * operator
Implements CPS::Attribute< T >.
Definition at line 667 of file Attribute.h.
|
inlineoverridevirtual |
Check whether this is a static or dynamic attribute
AttributeStatic
, false for instances of AttributeDynamic
Implements CPS::AttributeBase.
Definition at line 674 of file Attribute.h.
|
inlineoverridevirtual |
Manually set the attribute to the given value. For dynamic attributes, this will trigger the UPDATE_ON_SET tasks for updating any dependency attributes.
Implements CPS::Attribute< T >.
Definition at line 660 of file Attribute.h.
|
inlineoverridevirtual |
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 |
Implements CPS::Attribute< T >.
Definition at line 635 of file Attribute.h.