| GL Studio C++ Runtime API

Public Member Functions | Protected Attributes | List of all members
DistiAttribute< T > Class Template Reference

`#include <disti_metadata.h>`

Inheritance diagram for DistiAttribute< T >:

## 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
DistiAttributeBase & | operator= (const DistiAttributeBase &oldClass) override
std::ostream & | WriteValue (std::ostream &outstr) override
std::istream & | ReadValue (std::istream &instr) override
std::string | Type () const 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 DistiAttributeBase & | operator= (const DistiAttributeBase &oldClass)
const AttributeName & | Name () const
AttributeName & | Name ()
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 std::string | Type () const
virtual bool | operator== (const DistiAttributeBase &r)
template<class valType >
DistiAttributeBase & | operator<< (const valType &val)
template<class valType >
DistiAttributeBase & | operator>> (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

  callback | The method to call when the value changes. A duplicate of the CallbackMethodCallerBase is created and stored internally.
  name | The name of the attribute
  attribPtr | The 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

  callback | The method to call when the value changes. A duplicate of the CallbackMethodCallerBase is created and stored internally.
  name | The name of the attribute
  initialValue | The initial value of the internally stored variable.

## ◆ ~DistiAttribute()

~DistiAttribute | ( |  | ) |
| inline override

Destructor deletes local storage if we created it

## Member Function Documentation

## ◆ Copyable()

bool Copyable | ( |  | ) | const
| inline override virtual

Returns
  Whether or not this attribute is copyable (which it is).

Reimplemented from DistiAttributeBase.

## ◆ operator=()

DistiAttributeBase & operator= | ( | const DistiAttributeBase & | oldClass | ) |
| inline override virtual

Assignment operator

Parameters

  oldClass | The attribute to assign.

Returns
  The resulting attribute (this).

Reimplemented from DistiAttributeBase.

## ◆ operator==()

bool operator== | ( | const DistiAttributeBase & | rArg | ) |
| inline override virtual

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

Parameters

  rArg | The 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 | ) |
| inline override virtual

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

Parameters

  instr | The stream to read from.

Returns
  The stream in its updated state.

Implements DistiAttributeBase.

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

## ◆ Type()

std::string Type | ( |  | ) | const
| inline override virtual

Demangles type T.

Returns
  String containing new name for type T.

Precondition
  none

Postcondition
  none

Reimplemented from DistiAttributeBase.

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

## ◆ Value() [1/2]

virtual T Value | ( |  | ) |
| inline virtual

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 | ) |
| inline virtual

Allows for type specific access to the data.

Parameters

  val | The value to set in the attribute's type.

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

## ◆ ValueFloat() [1/2]

double ValueFloat | ( |  | ) |
| inline override virtual

Returns
  The double value of this attribute.

Reimplemented from DistiAttributeBase.

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

## ◆ ValueFloat() [2/2]

void ValueFloat | ( | double | val | ) |
| inline override virtual

Set the double value for this attribute.

Parameters

  val | The double value to set for this attribute.

Reimplemented from DistiAttributeBase.

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

## ◆ ValueInt() [1/2]

long ValueInt | ( |  | ) |
| inline override virtual

Returns
  The integer value of this attribute.

Reimplemented from DistiAttributeBase.

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

## ◆ ValueInt() [2/2]

void ValueInt | ( | long | val | ) |
| inline override virtual

Set the integer value of this attribute.

Parameters

  val | The integer value to set for this attribute.

Reimplemented from DistiAttributeBase.

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

## ◆ WriteValue()

std::ostream & WriteValue | ( | std::ostream & | outstr | ) |
| inline override virtual

Write this attribute's string value to the stream.

Parameters

  outstr | The 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:

- disti_metadata.h