Jamoma API  0.6.0.a19
TTObjectBase.h
Go to the documentation of this file.
1 /** @file
2  @ingroup foundationLibrary
3 
4  @brief The Jamoma Object Base Class.
5 
6  @details Base class for all first-class Jamoma objects.
7  Internal objects may inherit directly from #TTObjectBase,
8  but most objects will inherit from #TTDataObjectBase or #TTAudioObjectBase.
9 
10  @author Timothy Place, Theo de la Hogue, Trond Lossius
11 
12  @copyright Copyright © 2008, Timothy Place @n
13  This code is licensed under the terms of the "New BSD License" @n
14  http://creativecommons.org/licenses/BSD/
15  */
16 
17 #ifndef __TT_OBJECTBASE_H__
18 #define __TT_OBJECTBASE_H__
19 
20 #include "TTBase.h"
21 #include "TTList.h"
22 #include "TTHash.h"
23 #include "TTSymbol.h"
24 #include "TTSymbolTable.h"
25 #include "TTSymbolCache.h"
26 #include "TTValue.h"
27 #include "TTSymbolCache.h"
28 
29 // forward declarations needed by the compiler
30 class TTAttribute;
31 class TTMessage;
32 class TTObjectBase;
33 class TTClass;
34 
36 typedef TTMessage* TTMessagePtr;
40 typedef TTClass* TTClassPtr;
41 
42 
43 /** A type that can be used to store a pointer to a message for an object.
44  @ingroup typedefs
45  */
46 typedef TTErr (TTObjectBase::*TTMethod)(const TTSymbol methodName, const TTValue& anInputValue, TTValue& anOutputValue);
47 
48 
49 /** A type that can be used to call a message for an object that does not declare the name argument.
50  @ingroup typedefs
51  */
52 typedef TTErr (TTObjectBase::*TTMethodValue)(const TTValue& anInputValue, TTValue& anOutputValue);
53 
54 /** A type that can be used to call a message for an object that does not declare the name argument.
55  @ingroup typedefs
56  */
57 typedef TTErr (TTObjectBase::*TTMethodInputValue)(const TTValue& anInputValue);
58 
59 /** A type that can be used to call a message for an object that does not declare the name argument.
60  @ingroup typedefs
61  */
62 typedef TTErr (TTObjectBase::*TTMethodOutputValue)(TTValue& anOutputValue);
63 
64 /** A type that can be used to call a message for an object that does not declare any arguments.
65  @ingroup typedefs
66  */
68 
69 
70 /** A type that can be used to store a pointer to a message for an object
71  @ingroup typedefs
72  */
73 typedef TTErr (TTObjectBase::*TTGetterMethod)(const TTAttribute& attribute, TTValue& value);
74 
75 /** A type that can be used to store a pointer to a message for an object
76  @ingroup typedefs
77  */
78 typedef TTErr (TTObjectBase::*TTSetterMethod)(const TTAttribute& attribute, const TTValue& value);
79 
80 
81 /** Flags that determine the behavior of messages.
82  @ingroup enums
83  */
85  kTTMessageDefaultFlags = 0, ///< The default set of flags will be used if this is specified. At this time the default is #kTTMethodPassValue.
86  kTTMessagePassNone = 1, ///< Set this flag if the method you are binding to this message is prototyped to accept no arguments.
87  kTTMessagePassValue = 2, ///< Set this flag if the method you are binding to this message is prototyped with a single #TTValue& argument.
88  kTTMessagePassNameAndValue = 4 ///< Set this flag if the method you are binding to this message is prototyped with two arguments: a const #TTSymbol and a #TTValue&.
89 };
90 
91 /** Flags that determine the behavior of messages.
92  @ingroup enums
93  */
95  kTTAttrDefaultFlags = 0, ///< The default set of flags will be used if this is specified. At this time the default is #kTTAttrPassValueOnly.
96  kTTAttrPassValueOnly = 1, ///< Attribute accessors will only be passed a reference to the attribute's value.
97  kTTAttrPassObject = 2 ///< Attribute accessors will first be passed a reference to the #TTAttribute object, then it will be passed a reference to the attribute's value.
98 };
99 
100 
101 /****************************************************************************************************/
102 // Class Specifications
103 
104 /**
105  Base class for all first-class Jamoma objects.
106  Internal objects may inherit directly from #TTObjectBase,
107  but most objects will inherit from #TTDataObjectBase or #TTAudioObjectBase.
108 */
109 class TTFOUNDATION_EXPORT TTObjectBase {
110 private:
111  friend class TTEnvironment;
112 
113  TTClassPtr classPtr; ///< The class definition for this object
114  TTHash* messages; ///< The collection of all messages for this object, keyed on the message name.
115  TTHash* attributes; ///< The collection of all attributes for this object, keyed on the attribute name.
116 protected:
117  TTList observers; ///< List of all objects watching this object for life-cycle and other changes.
118 private:
119  TTList* messageObservers; ///< List of all objects watching this object for messages sent to it.
120  TTList* attributeObservers; ///< List of all objects watching this object for changes to attribute values.
121  TTAtomicInt mLocked; ///< E.g. is this object busy doing something that would prevent us from being able to free it?
122  TTUInt16 referenceCount; ///< Reference count for this instance.
123 public:
124  TTBoolean valid; ///< If the object isn't completely built, or is in the process of freeing, this will be false.
125  TTBoolean track; ///< enable the print of a log message to ease the track of reference counting mechanism on an instance
126  ///< @see
127 private:
128  TTPtrSizedInt reserved1; ///< Reserved -- May be used for something in the future without changing the size of the struct.
129  //TTPtrSizedInt reserved2; ///< Reserved -- May be used for something in the future without changing the size of the struct.
130 
131 protected:
132  /** Constructor.
133  @param arguments Arguments to the constructor.
134  */
135  TTObjectBase(const TTValue arguments);
136 public:
137  /** Destructor.
138  */
139  virtual ~TTObjectBase();
140 
141  /** Query an object to get its current reference count.
142  @return Reference count.
143  */
144  TTUInt16 getReferenceCount() {return referenceCount;}
145 
146  /** Query an object to get the number of observers.
147  @return Observers list size.
148  */
149  TTUInt32 getObserverCount() const {return observers.getSize();}
150 
151  /** @brief Register an attribute
152  @details The theory on attributes is that the subclass calls registerAttribute()
153  and the base class manages a list of all registered attributes.
154  The the end-user calls setAttribute() on the object (which is defined in
155  the base class only) and it dispatches the message as appropriate.
156 
157  @param name The name of the attribute
158  @param type The data type of the attribute
159  @param address Pointer to the address of the attribute
160  @param getter An optional getter method
161  @param setter An optional setter method
162  @param newGetterObject TODO: Document this
163  @param newSetterObject TODO: Document this
164 
165  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
166  */
167  TTErr registerAttribute(const TTSymbol name, const TTDataType type, void* address);
168  TTErr registerAttribute(const TTSymbol name, const TTDataType type, void* address, TTGetterMethod getter);
169  TTErr registerAttribute(const TTSymbol name, const TTDataType type, void* address, TTSetterMethod setter);
170  TTErr registerAttribute(const TTSymbol name, const TTDataType type, void* address, TTGetterMethod getter, TTSetterMethod setter);
171  TTErr registerAttribute(const TTSymbol name, const TTObjectBasePtr newGetterObject, const TTObjectBasePtr newSetterObject);
172 
173 
174  /** Extend the attribute of an existing TTObjectBase to this TTObjectBase (using another attribute name)
175  @param name The name of the attribute as you wish for it to be in your object (e.g. myFrequency).
176  @param extendedObject A pointer to the object to which the attribute will be bound.
177  @param extendedName The name of the attribute as defined by the object that you are extending (e.g. frequency).
178  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
179  */
180  TTErr extendAttribute(const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName);
181 
182 
183  /** Remove an attribute.
184  @param name The name of the attribute to remove.
185  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
186  */
187  TTErr removeAttribute(const TTSymbol name);
188 
189 
190  /** Find an attribute.
191  @param name The name of the attribute to find.
192  @param attr Return pointer to the attribute associated with the name.
193  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
194  */
195  TTErr findAttribute(const TTSymbol name, TTAttribute** attr);
196 
197 
198  /** Set an attribute value for an object
199  @param name The name of the attribute to set.
200  @param value The value to use for setting the attribute.
201  This value can be changed(!), for example if the value is out of range for the attribute.
202  Hence, it is not declared const.
203  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
204  */
205  TTErr setAttributeValue(const TTSymbol name, TTValue& value);
206 
207  // special case for int literals
208  TTErr setAttributeValue(const TTSymbol name, int value)
209  {
210  TTValue v(value);
211  return setAttributeValue(name, v);
212  }
213 
214  // special case for float literals
215  TTErr setAttributeValue(const TTSymbol name, double value)
216  {
217  TTValue v(value);
218  return setAttributeValue(name, v);
219  }
220 
221  // special case for TTPtr
222  TTErr setAttributeValue(const TTSymbol name, TTPtr value)
223  {
224  TTValue v(value);
225  return setAttributeValue(name, v);
226  }
227 
228  template <class T>
229  TTErr setAttributeValue(const TTSymbol name, T& value)
230  {
231  TTValue v(value);
232  return setAttributeValue(name, v);
233  }
234 
235  TTErr setAttributeValue(const TTSymbol name, const char* value)
236  {
237  TTSymbol s(value);
238  TTValue v(s);
239  return setAttributeValue(name, v);
240  }
241 
242  /** Set an attribute value for an object
243  This is the same as calling setAttributeValue().
244  @param name The name of the attribute to set.
245  @param value The value to use for setting the attribute.
246  This value can be changed(!), for example if the value is out of range for the attribute.
247  Hence, it is not declared const.
248  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
249  */
250  template <class T>
251  TTErr set(const TTSymbol aName, T aValue)
252  {
253  return setAttributeValue(aName, aValue);
254  }
255 
256 
257  /** Get an attribute value for an object
258  @param name The name of the attribute to get.
259  @param value The returned value of the attribute.
260  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
261  */
262  TTErr getAttributeValue(const TTSymbol name, TTValue& value);
263 
264  template <class T>
265  TTErr getAttributeValue(const TTSymbol name, T& value)
266  {
267  TTValue v;
268  TTErr error = getAttributeValue(name, v);
269  value = v;
270  return error;
271  }
272 
273  /** Get an attribute value for an object
274  This is the same as calling getAttributeValue().
275  @param name The name of the attribute to get.
276  @param value The returned value of the attribute.
277  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
278  */
279  template <class T>
280  TTErr get(const TTSymbol aName, T& aReturnedValue)
281  {
282  return getAttributeValue(aName, aReturnedValue);
283  }
284 
285  /** Return the type of an attribute as a symbol.
286  @param name The name of the attribute we want the type.
287  @return #TTSymbol : kTTSym__none, kTTSym_uint8, kTTSym_int8, kTTSym_uint16, kTTSym_int16, kTTSym_uint32, kTTSym_int32, kTTSym_uint64, kTTSym_int64, kTTSym_float32, kTTSym_float64, kTTSym__boolean, kTTSym_symbol, kTTSym_string, kTTSym_pointer, kTTSym_object, kTTSym_value. Returns kTTSymEmpty if the attribute doesn't exist.
288  */
289  TTSymbol getAttributeType(const TTSymbol name);
290 
291  /** Get the getterFlags of an attribute
292  @param name The name of the attribute that we are querying properties of.
293  @param value Pointer to attribute flags. Used for returning the result of the query.
294  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
295  */
297 
298 
299  /** Set the getterFlags of an attribute
300  @param name The name of the attribute that we want to address.
301  @param value New values for the getterFlags property.
302  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
303  */
305 
306 
307  /** Get the setterFlags of an attribute
308  @param name The name of the attribute that we are querying properies of.
309  @param value Pointer to attribute flags. Used for returning the result of the query.
310  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
311  */
313 
314 
315  /** Set the setterFlags of an attribute
316  @param name The name of the attribute that we want to address.
317  @param value New values for the getterFlags property.
318  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
319  */
321 
322 
323  /** Register an attribute property.
324  @param attributeName Tyhe name of the attribute for which we want to register a new property.
325  @param propertyName The name of the property.
326  @param initialValue The initial value of the property.
327  @param getter The getter method associated with the property.
328  @param setter The setter method associated with the property.
329  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
330  */
331  TTErr registerAttributeProperty(const TTSymbol attributeName, const TTSymbol propertyName, const TTValue& initialValue, TTGetterMethod getter, TTSetterMethod setter);
332 
333 
334  /** Register an message property.
335  @param attributeName Tyhe name of the message for which we want to register a new property.
336  @param propertyName The name of the property.
337  @param initialValue The initial value of the property.
338  @param getter The getter method associated with the property.
339  @param setter The setter method associated with the property.
340  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
341  */
342  TTErr registerMessageProperty(const TTSymbol messageName, const TTSymbol propertyName, const TTValue& initialValue, TTGetterMethod getter, TTSetterMethod setter);
343 
344 
345  /** Search for and locate an attribute.
346  @param name The name of the attribute we want to find.
347  @param attributeObject Pointer to the attribute object.
348  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
349  */
350  TTErr getAttribute(const TTSymbol name, TTAttributePtr* attributeObject)
351  {
352  return findAttribute(name, attributeObject);
353  }
354 
355  /** Search for and locate a message.
356  @param name The name of the message we want to find.
357  @param messageObject Pointer to the message object.
358  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
359  */
360  TTErr getMessage(const TTSymbol name, TTMessagePtr* messageObject)
361  {
362  return findMessage(name, messageObject);
363  }
364 
365 
366  /** Return a list of names of the available attributes.
367  @param attributeNameList Pointer to a list of all attributes registered with this TTObjectBase.
368  */
369  void getAttributeNames(TTValue& attributeNameList);
370 
371 
372  /** Return a list of names of the available messages.
373  @param messageNameList Pointer to a list of all messages registered with this TTObjectBase.
374  */
375  void getMessageNames(TTValue& messageNameList);
376 
377 
378  /** Return the name of this class.
379  @return The name of this object.
380  */
381  TTSymbol getName() const;
382 
383 
384  /** Register a message with this object.
385  @param name The name of the message.
386  @flags Flags associated with the message.
387  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
388  */
389  TTErr registerMessage(const TTSymbol name, TTMethod method);
390  TTErr registerMessage(const TTSymbol name, TTMethod method, TTMessageFlags flags);
391 
392 
393  /** Find a message registered with this object.
394  @param name The name of the message that we want to find.
395  @param message Pointer to the resulting message.
396  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
397  */
398  TTErr findMessage(const TTSymbol name, TTMessage** message);
399 
400  /** Remove a message.
401  @param name The name of the message to remove.
402  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
403  */
404  TTErr removeMessage(const TTSymbol name);
405 
406 
407  /** TODO: Document this function
408  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
409  */
410  TTErr sendMessage(const TTSymbol name);
411 #ifdef TT_SUPPORT_SINGLE_ARG_MESSAGE_CALLS
412  TTErr sendMessage(const TTSymbol name, TTValue& anOutputValue);
413  TTErr sendMessage(const TTSymbol name, const TTValue& anInputValue);
414 #endif
415  TTErr sendMessage(const TTSymbol name, const TTValue& anInputValue, TTValue& anOutputValue);
416 
417  TTErr sendMessage(const TTSymbol name, const TTValue& anInputValue, TTNoValue /*ignore*/)
418  {
419  TTValue unusedReturnValue;
420  return sendMessage(name, anInputValue, unusedReturnValue);
421  }
422 
423 // TODO: implement
424 // TTErr registerMessageProperty(const TTSymbolRef messageName, const TTSymbolRef propertyName, const TTValue& initialValue);
425 
426 
427  /** Register an observer for a message.
428  The observer will be monitoring if this message is sent to the object.
429  @param observingObject Pointer to the observing object.
430  @param messageName The name of the message to monitor.
431  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
432  */
433  TTErr registerObserverForMessage(const TTObject& observingObject, const TTSymbol messageName);
434 
435 
436  /** Register an observer for an attribute.
437  The observer will be monitoring if this attribute is changes.
438  @param observingObject Pointer to the observing object.
439  @param attributeName The name of the attribute to monitor.
440  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
441  */
442  TTErr registerObserverForAttribute(const TTObject& observingObject, const TTSymbol attributeName);
443 
444 
445  /** Register an observer.
446  The observer will be monitoring this object.
447  TODO: Exactly what do this imply? What is being observed?
448  @param observingObject Pointer to the observing object.
449  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
450  */
451  TTErr registerObserverForNotifications(const TTObject& observingObject);
452 
453 
454  /** Unregister an observer for a message.
455  The observer will stop monitoring if this message is sent to the object.
456  @param observingObject Pointer to the observing object.
457  @param messageName The name of the message that no longer will be monitored.
458  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
459  */
460  TTErr unregisterObserverForMessage(const TTObject& observingObject, const TTSymbol messageName);
461 
462 
463  /** Unregister an observer for an attribute.
464  The observer will stop monitoring changes to this attribute.
465  @param observingObject Pointer to the observing object.
466  @param attributeName The name of the attribute that no longer will be monitored.
467  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
468  */
469  TTErr unregisterObserverForAttribute(const TTObject& observingObject, const TTSymbol attributeName);
470 
471 
472  /** Unregister an observer for notifications.
473  The observer wiln no longer be monitoring.
474  TODO: Exactly what do this imply?
475  @param observingObject Pointer to the observing object.
476  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
477  */
478  TTErr unregisterObserverForNotifications(const TTObject& observingObject);
479 
480 
481  /** Send a notification.
482  TODO: What do this imply?
483  @param name TODO: Document this
484  @param arguments TODO: Document this
485  */
486  TTErr sendNotification(const TTSymbol name, const TTValue& arguments);
487 
488 
489  /** Log messages scoped to this object instance.
490  @param fmtstring The message to log
491  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
492  */
493  TTErr logMessage(TTImmutableCString fmtstring, ...);
494 
495 
496  /** Log warnings scoped to this object instance.
497  @param fmtstring The warning to log
498  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
499  */
500  TTErr logWarning(TTImmutableCString fmtstring, ...);
501 
502 
503  /** Log errors scoped to this object instance.
504  @param fmtstring The error to log
505  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
506  */
507  TTErr logError(TTImmutableCString fmtstring, ...);
508 
509 
510  /** Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled in the environment.
511  @param fmtstring The message to log
512  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
513  */
514  TTErr logDebug(TTImmutableCString fmtstring, ...);
515 
516 
517  /** Lock the object in order to ensure thread-safe processing.
518  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
519  */
520  inline TTErr lock()
521  {
522  TTAtomicIncrement(mLocked);
523  return kTTErrNone;
524  }
525 
526 
527  /** Unlock the object when thread-safe processing is no longer required.
528  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
529  */
530  inline TTErr unlock()
531  {
532  TTAtomicDecrement(mLocked);
533  return kTTErrNone;
534  }
535 
536 
537  /** Query if the object currently is locked for thread-safe processing.
538  @return TRUE if the object is currently locked, else FALSE.
539  */
541  {
542  return mLocked > 0;
543  }
544 
545 
546  /** If the object is locked (e.g. in the middle of processing a vector in another thread)
547  then we spin until the lock is released
548  TODO: We should also be able to time-out in the event that we have a dead lock.
549  */
551  {
552  while (isLocked())
553  ;
554  return true; // TODO: might return false if the operation timed-out.
555  }
556 
557 };
558 
559 
560 #include "TTAttribute.h"
561 #include "TTMessage.h"
562 
563 
564 #define TT_OBJECT_CONSTRUCTOR_EXPORT \
565  \
566  extern "C" TT_EXTENSION_EXPORT TTErr loadTTExtension(void);\
567  TTErr loadTTExtension(void)\
568  {\
569  TTFoundationInit();\
570  thisTTClass :: registerClass(); \
571  return kTTErrNone;\
572  }\
573  \
574  TT_OBJECT_CONSTRUCTOR
575 
576 
577 #endif // __TT_OBJECTBASE_H__
578 
TTErr sendMessage(const TTSymbol name)
TODO: Document this function.
TTErr(TTObjectBase::* TTSetterMethod)(const TTAttribute &attribute, const TTValue &value)
A type that can be used to store a pointer to a message for an object.
Definition: TTObjectBase.h:78
TTClass * TTClassPtr
Pointer to a TTClass.
Definition: TTClass.h:86
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTErr registerMessageProperty(const TTSymbol messageName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
Register an message property.
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTErr unlock()
Unlock the object when thread-safe processing is no longer required.
Definition: TTObjectBase.h:530
TTErr registerObserverForNotifications(const TTObject &observingObject)
Register an observer.
The default set of flags will be used if this is specified. At this time the default is #kTTMethodPas...
Definition: TTObjectBase.h:85
TTErr(TTObjectBase::* TTMethodOutputValue)(TTValue &anOutputValue)
A type that can be used to call a message for an object that does not declare the name argument...
Definition: TTObjectBase.h:62
TTErr getAttributeSetterFlags(const TTSymbol name, TTAttributeFlags &value)
Get the setterFlags of an attribute.
This class represents a single message, as used by the TTObjectBase class.
Definition: TTMessage.h:55
std::atomic< int32_t > TTAtomicInt
An integer that can be used for atomic operations.
Definition: TTBase.h:243
TTErr unregisterObserverForNotifications(const TTObject &observingObject)
Unregister an observer for notifications.
The TTAttribute class represents a single attribute, as used by the TTObjectBase class.
TTErr getMessage(const TTSymbol name, TTMessagePtr *messageObject)
Search for and locate a message.
Definition: TTObjectBase.h:360
TTErr logMessage(TTImmutableCString fmtstring,...)
Log messages scoped to this object instance.
TTErr setAttributeGetterFlags(const TTSymbol name, TTAttributeFlags &value)
Set the getterFlags of an attribute.
TTErr removeAttribute(const TTSymbol name)
Remove an attribute.
TTErr logError(TTImmutableCString fmtstring,...)
Log errors scoped to this object instance.
TTSymbol getName() const
Return the name of this class.
TTErr setAttributeSetterFlags(const TTSymbol name, TTAttributeFlags &value)
Set the setterFlags of an attribute.
Create and use Jamoma object instances.
Definition: TTObject.h:29
TTErr getAttribute(const TTSymbol name, TTAttributePtr *attributeObject)
Search for and locate an attribute.
Definition: TTObjectBase.h:350
TTDataType
TTBlue Data Types Enumeration of data types used through out TTBlue, including the TTValue class and ...
Definition: TTBase.h:269
TTErr sendNotification(const TTSymbol name, const TTValue &arguments)
Send a notification.
TTErr(TTObjectBase::* TTMethodValue)(const TTValue &anInputValue, TTValue &anOutputValue)
A type that can be used to call a message for an object that does not declare the name argument...
Definition: TTObjectBase.h:52
TTErr getAttributeValue(const TTSymbol name, TTValue &value)
Get an attribute value for an object.
TTErr set(const TTSymbol aName, T aValue)
Set an attribute value for an object This is the same as calling setAttributeValue().
Definition: TTObjectBase.h:251
This class represents a single attribute, as used by the TTObjectBase class.
Definition: TTAttribute.h:79
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
TTErr findMessage(const TTSymbol name, TTMessage **message)
Find a message registered with this object.
TTErr(TTObjectBase::* TTMethod)(const TTSymbol methodName, const TTValue &anInputValue, TTValue &anOutputValue)
A type that can be used to store a pointer to a message for an object.
Definition: TTObjectBase.h:46
TTErr removeMessage(const TTSymbol name)
Remove a message.
TTErr unregisterObserverForAttribute(const TTObject &observingObject, const TTSymbol attributeName)
Unregister an observer for an attribute.
TTErr registerAttribute(const TTSymbol name, const TTDataType type, void *address)
Register an attribute.
TTErr logDebug(TTImmutableCString fmtstring,...)
Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled i...
TTErr setAttributeValue(const TTSymbol name, TTValue &value)
Set an attribute value for an object.
Maintain a collection of TTValue objects indexed by TTSymbol pointers.
Definition: TTHash.h:36
TTBoolean valid
If the object isn't completely built, or is in the process of freeing, this will be false...
Definition: TTObjectBase.h:124
TTErr registerMessage(const TTSymbol name, TTMethod method)
Register a message with this object.
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
TTMessageFlags
Flags that determine the behavior of messages.
Definition: TTObjectBase.h:84
Attribute accessors will only be passed a reference to the attribute's value.
Definition: TTObjectBase.h:96
Attribute accessors will first be passed a reference to the TTAttribute object, then it will be passe...
Definition: TTObjectBase.h:97
The TTClass object represents a class in the Jamoma environment.
Definition: TTClass.h:32
Jamoma's lowest-level base class and related infrastructure.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
void getMessageNames(TTValue &messageNameList)
Return a list of names of the available messages.
TTErr unregisterObserverForMessage(const TTObject &observingObject, const TTSymbol messageName)
Unregister an observer for a message.
TTSymbol getAttributeType(const TTSymbol name)
Return the type of an attribute as a symbol.
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) ...
The default set of flags will be used if this is specified. At this time the default is kTTAttrPassVa...
Definition: TTObjectBase.h:95
TTErr registerObserverForAttribute(const TTObject &observingObject, const TTSymbol attributeName)
Register an observer for an attribute.
TTObjectBase(const TTValue arguments)
Constructor.
TTBoolean track
enable the print of a log message to ease the track of reference counting mechanism on an instance ...
Definition: TTObjectBase.h:125
TTBoolean waitForLock()
If the object is locked (e.g.
Definition: TTObjectBase.h:550
TTErr logWarning(TTImmutableCString fmtstring,...)
Log warnings scoped to this object instance.
TTErr(TTObjectBase::* TTMethodNone)()
A type that can be used to call a message for an object that does not declare any arguments...
Definition: TTObjectBase.h:67
TTErr getAttributeGetterFlags(const TTSymbol name, TTAttributeFlags &value)
Get the getterFlags of an attribute.
TTErr registerObserverForMessage(const TTObject &observingObject, const TTSymbol messageName)
Register an observer for a message.
TTUInt32 getObserverCount() const
Query an object to get the number of observers.
Definition: TTObjectBase.h:149
Set this flag if the method you are binding to this message is prototyped with a single TTValue& argu...
Definition: TTObjectBase.h:87
TTBoolean isLocked()
Query if the object currently is locked for thread-safe processing.
Definition: TTObjectBase.h:540
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr registerAttributeProperty(const TTSymbol attributeName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
Register an attribute property.
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
virtual ~TTObjectBase()
Destructor.
TTAttributeFlags
Flags that determine the behavior of messages.
Definition: TTObjectBase.h:94
No Error.
Definition: TTBase.h:343
TTErr(TTObjectBase::* TTMethodInputValue)(const TTValue &anInputValue)
A type that can be used to call a message for an object that does not declare the name argument...
Definition: TTObjectBase.h:57
Set this flag if the method you are binding to this message is prototyped to accept no arguments...
Definition: TTObjectBase.h:86
Provides a common way of representing composite values.
TTErr(TTObjectBase::* TTGetterMethod)(const TTAttribute &attribute, TTValue &value)
A type that can be used to store a pointer to a message for an object.
Definition: TTObjectBase.h:73
TTErr lock()
Lock the object in order to ensure thread-safe processing.
Definition: TTObjectBase.h:520
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
void getAttributeNames(TTValue &attributeNameList)
Return a list of names of the available attributes.
Set this flag if the method you are binding to this message is prototyped with two arguments: a const...
Definition: TTObjectBase.h:88
TTUInt16 getReferenceCount()
Query an object to get its current reference count.
Definition: TTObjectBase.h:144
The global object maintains all global attributes/settings for the Jamoma environment.
Definition: TTEnvironment.h:47
TTList observers
List of all objects watching this object for life-cycle and other changes.
Definition: TTObjectBase.h:117
TTErr findAttribute(const TTSymbol name, TTAttribute **attr)
Find an attribute.