Jamoma API  0.6.0.a19
TTMessage.h
1 /*
2  * TTBlue Object Base Class
3  * Copyright © 2008, Timothy Place
4  *
5  * License: This code is licensed under the terms of the "New BSD License"
6  * http://creativecommons.org/licenses/BSD/
7  */
8 
9 #ifndef __TT_MESSAGE_H__
10 #define __TT_MESSAGE_H__
11 
12 #include "TTObjectBase.h"
13 
14 
15 /** A convenience macro to be used by subclasses for registering messages.
16  @ingroup macros
17  @param name The name of the message, and also the name of the classes' method to be called.
18 */
19 #define addMessage(name) registerMessage(#name, (TTMethod)& thisTTClass ::name , kTTMessagePassNone )
20 #define registerMessageSimple(name) registerMessage(#name, (TTMethod)& thisTTClass ::name , kTTMessagePassNone )
21 
22 
23 /** A convenience macro to be used by subclasses for registering messages.
24  @ingroup macros
25  @param name The name of the message, and also the name of the classes' method to be called.
26 */
27 #define addMessageWithArguments(name) registerMessage(#name, (TTMethod)& thisTTClass ::name )
28 #define registerMessageWithArguments(name) registerMessage(#name, (TTMethod)& thisTTClass ::name )
29 
30 
31 /** A convenience macro to be used for registering properties of messages.
32  This assumes that the property is one that has been explicitly supported by TTMessage through the definition of accessor methods.
33  If you are adding a custom property then you must define your own accessor methods and register the property by calling the
34  TTObjectBase::registerMessageProperty() method directly.
35  @ingroup macros
36  */
37 #define addMessageProperty(messageName, propertyName, initialValue) registerMessageProperty(#messageName, #propertyName, initialValue, (TTGetterMethod)& TTMessage::get##propertyName , (TTSetterMethod)& TTMessage::set##propertyName )
38 
39 
40 /** An 'update' is a message sent to a subclass instance from its parent class.
41  For example, to update the sample rate of the subclass when the parent's sample rate attribute has changed.
42  @ingroup macros
43  */
44 #define addUpdates(updateName) addMessageWithArguments(update##updateName); addMessageProperty(update##updateName, hidden, YES);
45 
46 
47 /****************************************************************************************************/
48 // Class Specifications
49 
50 /**
51  This class represents a single message, as used by the TTObjectBase class.
52  At the moment we define it in the same file because we are sharing the typedef
53  for TTMethod.
54 */
55 class TTFOUNDATION_EXPORT TTMessage : public TTObjectBase {
56 public:
57  // Should make this group private, but to get things working initially, we're leaving them public...
58  const TTSymbol name; ///< the name of the message.
59  TTMessageFlags flags; ///< define the behavior of the message.
60  TTMethod method; ///< method associated with this message.
61  TTBoolean hidden; ///< Property: this message is private/hidden from outside usage
62  TTSymbol description; ///< Property: description of this message
63 
64  TTMessage(const TTSymbol newName, TTMethod newMethod, TTMessageFlags newFlags);
65  virtual ~TTMessage();
66 
67  TTErr sethidden(const TTValue& newHiddenFlag);
68  TTErr gethidden(TTValue& currentHiddenFlag);
69 
70  TTErr setdescription(const TTValue& newDescription);
71  TTErr getdescription(TTValue& returnedDescription);
72 };
73 
74 
75 #endif // __TT_MESSAGE_H__
76 
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTSymbol description
Property: description of this message.
Definition: TTMessage.h:62
The Jamoma Object Base Class.
const TTSymbol name
the name of the message.
Definition: TTMessage.h:58
This class represents a single message, as used by the TTObjectBase class.
Definition: TTMessage.h:55
TTBoolean hidden
Property: this message is private/hidden from outside usage.
Definition: TTMessage.h:61
TTMethod method
method associated with this message.
Definition: TTMessage.h:60
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
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
TTMessageFlags
Flags that determine the behavior of messages.
Definition: TTObjectBase.h:84
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTMessageFlags flags
define the behavior of the message.
Definition: TTMessage.h:59
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34