DPsim
Public Member Functions | Friends | List of all members
CPS::AttributeStatic< T > Class Template Reference

#include <Attribute.h>

Inheritance diagram for CPS::AttributeStatic< T >:
[legend]
Collaboration diagram for CPS::AttributeStatic< T >:
[legend]

Public Member Functions

 AttributeStatic (T initialValue=T())
 
virtual void set (T value) override
 
virtual T & get () override
 
virtual bool isStatic () const override
 
virtual void setReference (typename Attribute< T >::Ptr reference) override
 
virtual std::shared_ptr< T > asRawPointer () override
 
virtual void appendDependencies (AttributeBase::Set *deps) override
 
- Public Member Functions inherited from CPS::Attribute< T >
 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 ()
 
- Public Member Functions inherited from CPS::AttributeBase
virtual AttributeBase::Set getDependencies () final
 

Friends

class SharedFactory< AttributeStatic< T > >
 

Additional Inherited Members

- Public Types inherited from CPS::Attribute< T >
using Type = T
 
using Ptr = AttributePointer< Attribute< T > >
 
- Public Types inherited from CPS::AttributeBase
typedef AttributePointer< AttributeBasePtr
 
typedef std::vector< PtrList
 
typedef std::set< Ptr, AttributeCmp< AttributeBase > > Set
 
typedef std::map< String, PtrMap
 
- Static Public Member Functions inherited from SharedFactory< AttributeStatic< T > >
static std::shared_ptr< AttributeStatic< T > > make (Args &&...args)
 
- Protected Attributes inherited from CPS::Attribute< T >
std::shared_ptr< T > mData
 

Detailed Description

template<class T>
class CPS::AttributeStatic< T >

Class for static attributes. A static attribute's value can only ever by changed via the get and set methods (or the reference provided by get). Static attributes do not directly depend on any other attributes and currently cannot have any update tasks.

Definition at line 541 of file Attribute.h.

Member Function Documentation

◆ appendDependencies()

template<class T >
virtual void CPS::AttributeStatic< T >::appendDependencies ( AttributeBase::Set *  deps)
inlineoverridevirtual

Append all dependencies of this attribute to the given set. For static attributes, this will only append this, for dynamic attributes, it will recursively collect and append all dependencies.

Implements CPS::AttributeBase.

Definition at line 560 of file Attribute.h.

◆ asRawPointer()

template<class T >
virtual std::shared_ptr<T> CPS::AttributeStatic< T >::asRawPointer ( )
inlineoverridevirtual

Exposing the underlying shared_ptr for this attribute's data. Used to create reference relations between two attributes.

Returns
The shared_ptr to this attribute's underlying data

Implements CPS::Attribute< T >.

Definition at line 558 of file Attribute.h.

◆ get()

template<class T >
virtual T& CPS::AttributeStatic< T >::get ( )
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 550 of file Attribute.h.

◆ isStatic()

template<class T >
virtual bool CPS::AttributeStatic< T >::isStatic ( ) const
inlineoverridevirtual

Check whether this is a static or dynamic attribute

Returns
true for instances of AttributeStatic, false for instances of AttributeDynamic

Implements CPS::AttributeBase.

Definition at line 552 of file Attribute.h.

◆ set()

template<class T >
virtual void CPS::AttributeStatic< T >::set ( value)
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 548 of file Attribute.h.

◆ setReference()

template<class T >
virtual void CPS::AttributeStatic< T >::setReference ( typename Attribute< T >::Ptr  reference)
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.

Parameters
referenceThe attribute which's value will be adapted

Implements CPS::Attribute< T >.

Definition at line 554 of file Attribute.h.


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