GL Studio C++ Runtime API
DistiAttribute< T > Class Template Reference

#include <disti_metadata.h>

Inheritance diagram for DistiAttribute< T >:
DistiAttributeBase WeakReferenceableMixin WeakReferenceable DistiAttributeNeverWrite< T > DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >

Public Member Functions

 DistiAttribute (CallbackMethodCallerBase *callback, const AttributeName &name, T *attribPtr)
 
 DistiAttribute (CallbackMethodCallerBase *callback, const AttributeName &name, const T &initialValue)
 
bool Copyable () const override
 
long ValueInt () override
 
void ValueInt (long val) override
 
double ValueFloat () override
 
void ValueFloat (double val) override
 
DistiAttributeBaseoperator= (const DistiAttributeBase &oldClass) override
 
std::ostream & WriteValue (std::ostream &outstr) override
 
std::istream & ReadValue (std::istream &instr) override
 
virtual T Value ()
 
virtual void Value (const T &val)
 
bool operator== (const DistiAttributeBase &rArg) override
 
 ~DistiAttribute () override
 
- Public Member Functions inherited from DistiAttributeBase
 DistiAttributeBase (CallbackMethodCallerBase *callback, const AttributeName &name, bool localStorage)
 
virtual DistiAttributeBaseoperator= (const DistiAttributeBase &oldClass)
 
const AttributeNameName () const
 
AttributeNameName ()
 
bool LocalStorage () const
 
virtual bool Copyable () const
 
virtual bool OkToWrite () const
 
virtual bool ValueChanged ()
 
virtual void ResetValueChanged ()
 
virtual std::string ValueString ()
 
virtual void ValueString (const std::string &s)
 
virtual long ValueInt ()
 
virtual void ValueInt (long val)
 
virtual double ValueFloat ()
 
virtual void ValueFloat (double val)
 
virtual void CallCallback ()
 Calls callback CallType3 if it has been set.
 
virtual std::ostream & WriteValue (std::ostream &outstr)=0
 
virtual std::istream & ReadValue (std::istream &instr)=0
 
virtual bool operator== (const DistiAttributeBase &r)
 
template<class valType >
DistiAttributeBaseoperator<< (const valType &val)
 
template<class valType >
DistiAttributeBaseoperator>> (valType &val)
 
virtual CallbackID RegisterObserver (AttributeObserver *observer)
 
virtual void UnregisterObserver (CallbackID id)
 
virtual void NotifyObservers ()
 
- Public Member Functions inherited from WeakReferenceableMixin
void AddWeakReference (WeakReference *weakRef) override
 
void NotifyWeakReferenceDestroyed (WeakReference *ref) override
 
virtual void AddWeakReference (WeakReference *weakRef)=0
 
virtual void NotifyWeakReferenceDestroyed (WeakReference *weakReference)=0
 

Protected Attributes

T * _attribPtr
 
int _precision
 
- Protected Attributes inherited from DistiAttributeBase
AttributeName _name
 
CallbackMethodCallerBase_callback
 
ScopedPtr< DistiAttributeObserverList > _observerList
 
bool _localStorage
 
- Protected Attributes inherited from WeakReferenceableMixin
DynamicArray< WeakReference * > * _weakRefs
 

Additional Inherited Members

- Public Types inherited from DistiAttributeBase
typedef unsigned int CallbackID
 Type for unique identifiers.
 
- Protected Member Functions inherited from WeakReferenceableMixin
 WeakReferenceableMixin ()
 
virtual ~WeakReferenceableMixin ()
 

Detailed Description

template<class T>
class disti::DistiAttribute< T >

A templated class for creating attributes.

Constructor & Destructor Documentation

◆ DistiAttribute() [1/2]

DistiAttribute ( CallbackMethodCallerBase callback,
const AttributeName name,
T *  attribPtr 
)
inline

Constructor Keeps a pointer to the specified type

Parameters
callbackThe method to call when the value changes. A duplicate of the CallbackMethodCallerBase is created and stored internally.
nameThe name of the attribute
attribPtrThe address of the storage.

◆ DistiAttribute() [2/2]

DistiAttribute ( CallbackMethodCallerBase callback,
const AttributeName name,
const T &  initialValue 
)
inline

Constructor Actually creates storage of the specified type

Parameters
callbackThe method to call when the value changes. A duplicate of the CallbackMethodCallerBase is created and stored internally.
nameThe name of the attribute
initialValueThe initial value of the internally stored variable.

◆ ~DistiAttribute()

~DistiAttribute ( )
inlineoverride

Destructor deletes local storage if we created it

Member Function Documentation

◆ Copyable()

bool Copyable ( ) const
inlineoverridevirtual
Returns
Whether or not this attribute is copyable (which it is).

Reimplemented from DistiAttributeBase.

◆ operator=()

DistiAttributeBase & operator= ( const DistiAttributeBase oldClass)
inlineoverridevirtual

Assignment operator

Parameters
oldClassThe attribute to assign.
Returns
The resulting attribute (this).

Reimplemented from DistiAttributeBase.

◆ operator==()

bool operator== ( const DistiAttributeBase rArg)
inlineoverridevirtual

Performs type specific comparison. This results in faster comparisons than the base class

Parameters
rArgThe attribute to compare.
Returns
Whether or not the attribute names and values are the same.

Reimplemented from DistiAttributeBase.

◆ ReadValue()

std::istream & ReadValue ( std::istream &  instr)
inlineoverridevirtual

Read from the stream, and store it in this attribute.

Parameters
instrThe stream to read from.
Returns
The stream in its updated state.

Implements DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ Value() [1/2]

virtual T Value ( )
inlinevirtual

Allows for type specific access to the data.

Returns
The underlying value of the attribute in its type.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ Value() [2/2]

virtual void Value ( const T &  val)
inlinevirtual

Allows for type specific access to the data.

Parameters
valThe value to set in the attribute's type.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ ValueFloat() [1/2]

double ValueFloat ( )
inlineoverridevirtual
Returns
The double value of this attribute.

Reimplemented from DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ ValueFloat() [2/2]

void ValueFloat ( double  val)
inlineoverridevirtual

Set the double value for this attribute.

Parameters
valThe double value to set for this attribute.

Reimplemented from DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ ValueInt() [1/2]

long ValueInt ( )
inlineoverridevirtual
Returns
The integer value of this attribute.

Reimplemented from DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ ValueInt() [2/2]

void ValueInt ( long  val)
inlineoverridevirtual

Set the integer value of this attribute.

Parameters
valThe integer value to set for this attribute.

Reimplemented from DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

◆ WriteValue()

std::ostream & WriteValue ( std::ostream &  outstr)
inlineoverridevirtual

Write this attribute's string value to the stream.

Parameters
outstrThe stream to write to.
Returns
The stream in its updated state.

Implements DistiAttributeBase.

Reimplemented in DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >.

Member Data Documentation

◆ _attribPtr

T* _attribPtr
protected

Points to the actual storage

◆ _precision

int _precision
protected

Allows for setting of precision for floating point numbers


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