Jamoma API  0.6.0.a19
TTAttribute Class Reference

This class represents a single attribute, as used by the TTObjectBase class. More...

#include <TTAttribute.h>

+ Inheritance diagram for TTAttribute:
+ Collaboration diagram for TTAttribute:

Public Member Functions

 TTAttribute (const TTSymbol newName, TTDataType newType, void *newAddress)
 Object constructor.
 
virtual ~TTAttribute ()
 Object destructor.
 
void setGetterFlags (TTAttributeFlags newFlags)
 Set the getterFlag property of the attribute, defining the behavior of the attribute getter method. More...
 
void getGetterFlags (TTAttributeFlags &currentFlags)
 Get the current getterFlag property of the attribute, describing the behavior of the attribute getter method. More...
 
void setSetterFlags (TTAttributeFlags newFlags)
 Set the setterFlag property of the attribute, defining the behavior of the attribute setter method. More...
 
void getSetterFlags (TTAttributeFlags &currentFlags)
 Get the current setterFlag property of the attribute, describing the behavior of the attribute setter method. More...
 
TTErr defaultGetter (const TTAttribute &attribute, TTValue &value)
 The default method for getting the current attribute value. More...
 
TTErr defaultSetter (const TTAttribute &attribute, const TTValue &value)
 The default method for setting the attribute value. More...
 
TTErr callbackGetter (const TTAttribute &attribute, TTValue &value)
 TODO: This needs to be documented. More...
 
TTErr callbackSetter (const TTAttribute &attribute, TTValue &value)
 TODO: This needs to be documented. More...
 
TTErr extendedGetter (const TTAttribute &attribute, TTValue &value)
 TODO: This needs to be documented. More...
 
TTErr extendedSetter (const TTAttribute &attribute, TTValue &value)
 TODO: This needs to be documented. More...
 
TTErr setreadOnly (const TTValue &newReadOnlyValue)
 Set the readOnly property of the attribute, controlling if the attribute value can be changed or not. More...
 
TTErr getreadOnly (TTValue &currentReadOnlyValue)
 Get the readOnly property of the attribute, controlling if the attribute value can be changed or not. More...
 
TTErr setrange (const TTValue &newRange)
 Set the range of possible values for the attribute. More...
 
TTErr getrange (TTValue &currentRange)
 Get the range of possible values for the attribute. More...
 
TTErr setrangeChecking (const TTValue &newRangeCheckingMode)
 Set the range boundary checking mode property for the attribute. More...
 
TTErr getrangeChecking (TTValue &currentRangeCheckingMode)
 Get the range boundary checking mode property for the attribute. More...
 
TTErr sethidden (const TTValue &newHiddenFlag)
 Set the hidden flag for the attribute, determining if this attribute is private/invisible to the outside world. More...
 
TTErr gethidden (TTValue &currentHiddenFlag)
 Get the hidden flag for the attribute, indicating if this attribute is private/invisible to the outside world. More...
 
TTErr setdescription (const TTValue &newDescription)
 Set the description property of the attribute, used for documentation purposes. More...
 
TTErr getdescription (TTValue &returnedDescription)
 Get the description property of the attribute, used for documentation purposes. More...
 
- Public Member Functions inherited from TTObjectBase
virtual ~TTObjectBase ()
 Destructor.
 
TTUInt16 getReferenceCount ()
 Query an object to get its current reference count. More...
 
TTUInt32 getObserverCount () const
 Query an object to get the number of observers. More...
 
TTErr registerAttribute (const TTSymbol name, const TTDataType type, void *address)
 Register an attribute. More...
 
TTErr extendAttribute (const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName)
 Extend the attribute of an existing TTObjectBase to this TTObjectBase (using another attribute name) More...
 
TTErr removeAttribute (const TTSymbol name)
 Remove an attribute. More...
 
TTErr findAttribute (const TTSymbol name, TTAttribute **attr)
 Find an attribute. More...
 
TTErr setAttributeValue (const TTSymbol name, TTValue &value)
 Set an attribute value for an object. More...
 
template<class T >
TTErr set (const TTSymbol aName, T aValue)
 Set an attribute value for an object This is the same as calling setAttributeValue(). More...
 
TTErr getAttributeValue (const TTSymbol name, TTValue &value)
 Get an attribute value for an object. More...
 
template<class T >
TTErr get (const TTSymbol aName, T &aReturnedValue)
 Get an attribute value for an object This is the same as calling getAttributeValue(). More...
 
TTSymbol getAttributeType (const TTSymbol name)
 Return the type of an attribute as a symbol. More...
 
TTErr getAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the getterFlags of an attribute. More...
 
TTErr setAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the getterFlags of an attribute. More...
 
TTErr getAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the setterFlags of an attribute. More...
 
TTErr setAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the setterFlags of an attribute. More...
 
TTErr registerAttributeProperty (const TTSymbol attributeName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an attribute property. More...
 
TTErr registerMessageProperty (const TTSymbol messageName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an message property. More...
 
TTErr getAttribute (const TTSymbol name, TTAttributePtr *attributeObject)
 Search for and locate an attribute. More...
 
TTErr getMessage (const TTSymbol name, TTMessagePtr *messageObject)
 Search for and locate a message. More...
 
void getAttributeNames (TTValue &attributeNameList)
 Return a list of names of the available attributes. More...
 
void getMessageNames (TTValue &messageNameList)
 Return a list of names of the available messages. More...
 
TTSymbol getName () const
 Return the name of this class. More...
 
TTErr registerMessage (const TTSymbol name, TTMethod method)
 Register a message with this object. More...
 
TTErr findMessage (const TTSymbol name, TTMessage **message)
 Find a message registered with this object. More...
 
TTErr removeMessage (const TTSymbol name)
 Remove a message. More...
 
TTErr sendMessage (const TTSymbol name)
 TODO: Document this function. More...
 
TTErr registerObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Register an observer for a message. More...
 
TTErr registerObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Register an observer for an attribute. More...
 
TTErr registerObserverForNotifications (const TTObject &observingObject)
 Register an observer. More...
 
TTErr unregisterObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Unregister an observer for a message. More...
 
TTErr unregisterObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Unregister an observer for an attribute. More...
 
TTErr unregisterObserverForNotifications (const TTObject &observingObject)
 Unregister an observer for notifications. More...
 
TTErr sendNotification (const TTSymbol name, const TTValue &arguments)
 Send a notification. More...
 
TTErr logMessage (TTImmutableCString fmtstring,...)
 Log messages scoped to this object instance. More...
 
TTErr logWarning (TTImmutableCString fmtstring,...)
 Log warnings scoped to this object instance. More...
 
TTErr logError (TTImmutableCString fmtstring,...)
 Log errors scoped to this object instance. More...
 
TTErr logDebug (TTImmutableCString fmtstring,...)
 Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled in the environment. More...
 
TTErr lock ()
 Lock the object in order to ensure thread-safe processing. More...
 
TTErr unlock ()
 Unlock the object when thread-safe processing is no longer required. More...
 
TTBoolean isLocked ()
 Query if the object currently is locked for thread-safe processing. More...
 
TTBoolean waitForLock ()
 If the object is locked (e.g. More...
 

Public Attributes

const TTSymbol name
 The name of the attribute.
 
TTDataType type
 The data type of the attribute value.
 
void * address
 Pointer to the memory holding the attribute value.
 
TTGetterMethod getter
 Method to fetch the attribute value.
 
TTSetterMethod setter
 Method to set the attribute value.
 
const TTObjectBasePtr getterObject
 TTObjectBasePtr to fetch the attribute value.
 
const TTObjectBasePtr setterObject
 TTObjectBasePtr to set the attribute value.
 
TTAttributeFlags getterFlags
 Define the behavior of the attribute getter method.
 
TTAttributeFlags setterFlags
 Define the behavior of the attribute setter method.
 
TTValue internalValue
 Attributes that maintain their own data use this member to store it. More...
 
TTBoolean readOnly
 The readonly property, if defined, means an attribute cannot be set.
 
TTFloat64 rangeLowBound
 If the range property is defined, this is the bottom of a value's range.
 
TTFloat64 rangeHighBound
 If the range property is defined, this is the top of a value's range.
 
TTSymbol rangeChecking
 If the rangeChecking property is defined, the value should be checked for range and modified accordingly.
 
TTBoolean hidden
 Property: this attribute is private/invisible to the outside world.
 
TTSymbol description
 Property: description of this attribute.
 
TTValue mDefaultValue
 Property: the default value for this attribute.
 
- Public Attributes inherited from TTObjectBase
TTBoolean valid
 If the object isn't completely built, or is in the process of freeing, this will be false.
 
TTBoolean track
 enable the print of a log message to ease the track of reference counting mechanism on an instance More...
 

Additional Inherited Members

- Protected Member Functions inherited from TTObjectBase
 TTObjectBase (const TTValue arguments)
 Constructor. More...
 
- Protected Attributes inherited from TTObjectBase
TTList observers
 List of all objects watching this object for life-cycle and other changes.
 

Detailed Description

This class represents a single attribute, as used by the TTObjectBase class.

At the moment we define it in the same file because we are sharing the typedef for TTMethod.

Definition at line 79 of file TTAttribute.h.

Member Function Documentation

TTErr TTAttribute::callbackGetter ( const TTAttribute attribute,
TTValue value 
)

TODO: This needs to be documented.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 231 of file TTAttribute.cpp.

References getterObject, and TTCallback::notify().

+ Here is the call graph for this function:

TTErr TTAttribute::callbackSetter ( const TTAttribute attribute,
TTValue value 
)

TODO: This needs to be documented.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 238 of file TTAttribute.cpp.

References TTCallback::notify(), and setterObject.

+ Here is the call graph for this function:

TTErr TTAttribute::defaultGetter ( const TTAttribute attribute,
TTValue value 
)

The default method for getting the current attribute value.

Parameters
TTAttributeThe attribute
TTValuePointer to a TTValue used to return the current value of the attribute.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 107 of file TTAttribute.cpp.

References address, kTTErrInvalidType, kTTErrNone, kTypeBoolean, kTypeFloat32, kTypeFloat64, kTypeInt16, kTypeInt32, kTypeInt64, kTypeInt8, kTypeLocalValue, kTypeObject, kTypePointer, kTypeString, kTypeSymbol, kTypeUInt16, kTypeUInt32, kTypeUInt64, kTypeUInt8, and type.

Referenced by TTAttribute().

TTErr TTAttribute::defaultSetter ( const TTAttribute attribute,
const TTValue value 
)

The default method for setting the attribute value.

Parameters
TTAttributeThe attribute
TTValueThe new value of the attribute.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 171 of file TTAttribute.cpp.

References address, kTTErrInvalidType, kTTErrNone, kTypeBoolean, kTypeFloat32, kTypeFloat64, kTypeInt16, kTypeInt32, kTypeInt64, kTypeInt8, kTypeLocalValue, kTypeObject, kTypePointer, kTypeString, kTypeSymbol, kTypeUInt16, kTypeUInt32, kTypeUInt64, kTypeUInt8, and type.

Referenced by TTAttribute().

TTErr TTAttribute::extendedGetter ( const TTAttribute attribute,
TTValue value 
)

TODO: This needs to be documented.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 245 of file TTAttribute.cpp.

References TTObjectBase::getAttributeValue(), getterObject, and name.

+ Here is the call graph for this function:

TTErr TTAttribute::extendedSetter ( const TTAttribute attribute,
TTValue value 
)

TODO: This needs to be documented.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 252 of file TTAttribute.cpp.

References name, TTObjectBase::setAttributeValue(), and setterObject.

+ Here is the call graph for this function:

TTErr TTAttribute::getdescription ( TTValue returnedDescription)

Get the description property of the attribute, used for documentation purposes.

Parameters
returnedDescriptionPointer to a TTValue used to return the current value for the documentation property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 324 of file TTAttribute.cpp.

References description, and kTTErrNone.

void TTAttribute::getGetterFlags ( TTAttributeFlags currentFlags)

Get the current getterFlag property of the attribute, describing the behavior of the attribute getter method.

Parameters
currentFlagsPointer to a TTValue used to return the current value of the getterFlag property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 91 of file TTAttribute.cpp.

References getterFlags.

Referenced by TTObjectBase::getAttributeGetterFlags().

TTErr TTAttribute::gethidden ( TTValue currentHiddenFlag)

Get the hidden flag for the attribute, indicating if this attribute is private/invisible to the outside world.

Parameters
currentHiddenFlagPointer to a TTValue used to return the current value for the hidden flag.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 311 of file TTAttribute.cpp.

References hidden, and kTTErrNone.

TTErr TTAttribute::getrange ( TTValue currentRange)

Get the range of possible values for the attribute.

Parameters
currentRangePointer to a TTValue used to return the current value for the range property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 283 of file TTAttribute.cpp.

References TTValue::append(), TTValue::clear(), kTTErrNone, rangeHighBound, and rangeLowBound.

+ Here is the call graph for this function:

TTErr TTAttribute::getrangeChecking ( TTValue currentRangeCheckingMode)

Get the range boundary checking mode property for the attribute.

Parameters
currentRangeCheckingModePointer to a TTValue used to return the current value for the range boundary checking mode property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 298 of file TTAttribute.cpp.

References kTTErrNone, and rangeChecking.

TTErr TTAttribute::getreadOnly ( TTValue currentReadOnlyValue)

Get the readOnly property of the attribute, controlling if the attribute value can be changed or not.

Parameters
currentReadOnlyValuePointer to a TTValue used to return the current value of the readOnly property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 265 of file TTAttribute.cpp.

References kTTErrNone, and readOnly.

void TTAttribute::getSetterFlags ( TTAttributeFlags currentFlags)

Get the current setterFlag property of the attribute, describing the behavior of the attribute setter method.

Parameters
currentFlagsPointer to a TTValue used to return the current value of the setterFlag property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 101 of file TTAttribute.cpp.

References setterFlags.

Referenced by TTObjectBase::getAttributeSetterFlags().

TTErr TTAttribute::setdescription ( const TTValue newDescription)

Set the description property of the attribute, used for documentation purposes.

Parameters
newDescriptionThe new value for the documentation property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 318 of file TTAttribute.cpp.

References description, and kTTErrNone.

void TTAttribute::setGetterFlags ( TTAttributeFlags  newFlags)

Set the getterFlag property of the attribute, defining the behavior of the attribute getter method.

Parameters
newFlagsThe new value for the getterFlag property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 86 of file TTAttribute.cpp.

References getterFlags.

Referenced by TTObjectBase::registerAttribute(), and TTObjectBase::setAttributeGetterFlags().

TTErr TTAttribute::sethidden ( const TTValue newHiddenFlag)

Set the hidden flag for the attribute, determining if this attribute is private/invisible to the outside world.

Parameters
newHiddenFlagThe new value for the hidden flag.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 305 of file TTAttribute.cpp.

References hidden, and kTTErrNone.

TTErr TTAttribute::setrange ( const TTValue newRange)

Set the range of possible values for the attribute.

Parameters
newRangeThe new value for the range property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 272 of file TTAttribute.cpp.

References kTTErrNone, kTTErrWrongNumValues, rangeHighBound, rangeLowBound, and TTValue::size().

+ Here is the call graph for this function:

TTErr TTAttribute::setrangeChecking ( const TTValue newRangeCheckingMode)

Set the range boundary checking mode property for the attribute.

Parameters
newRangeCheckingModeThe new range range boundary checking mode property for the attribute.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 292 of file TTAttribute.cpp.

References kTTErrNone, and rangeChecking.

TTErr TTAttribute::setreadOnly ( const TTValue newReadOnlyValue)

Set the readOnly property of the attribute, controlling if the attribute value can be changed or not.

Parameters
newReadOnlyValueThe new value for the readOnly property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 259 of file TTAttribute.cpp.

References kTTErrNone, and readOnly.

void TTAttribute::setSetterFlags ( TTAttributeFlags  newFlags)

Set the setterFlag property of the attribute, defining the behavior of the attribute setter method.

Parameters
newFlagsThe new value for the setterFlag property.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 96 of file TTAttribute.cpp.

References setterFlags.

Referenced by TTObjectBase::registerAttribute(), and TTObjectBase::setAttributeSetterFlags().

Member Data Documentation

TTValue TTAttribute::internalValue

Attributes that maintain their own data use this member to store it.

This should typically only be used by attribute properties that are not performance critical.

Definition at line 92 of file TTAttribute.h.


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