Jamoma API  0.6.0.a19
TTContainer.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularLibrary
4  *
5  * @brief A Container object
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue
10  *
11  * @copyright © 2010, Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #ifndef __TT_CONTAINER_H__
18 #define __TT_CONTAINER_H__
19 
20 #include "TTModularIncludes.h"
21 
22 /** TTContainer ... TODO : an explanation
23  In Max j.view and j.model are based on this class.
24 
25  */
26 
27 class TTMODULAR_EXPORT TTContainer : public TTObjectBase
28 {
30 
31 private:
32 
33  TTInt32 mPriority; ///< ATTRIBUTE : does this container have a priority over other containers ?
34  TTSymbol mDescription; ///< ATTRIBUTE : a text label to describe the role of this container
35  TTSymbol mService; ///< ATTRIBUTE : a symbol used to type the container (this is mainly for Max to say if it is a view or a model)
36  TTValue mTags; ///< ATTRIBUTE : tag list for this container
37  TTBoolean mInitialized; ///< ATTRIBUTE : is it initialized ?
38  TTBoolean mActive; ///< ATTRIBUTE : is it active ?
39  TTAddress mAddress; ///< ATTRIBUTE : the address of the container in the directory
40  TTAddress mAlias; ///< ATTRIBUTE : an alias address to retrieve the container using another address
41  TTValue mActivity; ///< ATTRIBUTE : a local value to allow observation of outputing data
42  TTValue mContent; ///< ATTRIBUTE : a local value to allow observation of all address handled by the container
43  TTObject mReturnAddressCallback; ///< a way to return back address to the owner of this container
44  TTObject mReturnValueCallback; ///< a way to return back value to the owner of this container
45  TTHash mObjectsObserversCache; ///< a hash table containing all <relativeAddress : Objects, ValueObserver, InitializedObserver> for quick access
46  TTObject mObserver; ///< a life cycle observer
47  TTBoolean mIsSending; ///< a flag to lock the object in case of infinite loop
48 
49  TTAttributePtr activityAttribute; ///< cache activity attribute for observer notification
50  TTAttributePtr contentAttribute; ///< cache content attribute for observer notification
51 
52  /** */
53  TTErr Send(TTValue& AddressAndValue, TTValue& outputValue);
54 
55  /** */
56  TTErr Init();
57  TTErr initNode(TTNodePtr aNode);
58 
59  /** Rename the container
60  @param inputValue a new name.instance #TTSymbol
61  @param outputValue the effective #TTSymbol name.instance
62  @return #TTErr error code */
63  TTErr Rename(const TTValue& inputValue, TTValue& outputValue);
64 
65  /** */
66  TTErr AliasRemove();
67 
68  /** needed to be handled by a TTTextHandler */
69  TTErr WriteAsText(const TTValue& inputValue, TTValue& outputValue);
70 
71  /** */
72  TTErr setAddress(const TTValue& value);
73 
74  /** */
75  TTErr setAlias(const TTValue& value);
76 
77  /** Setter for mTags attribute. */
78  TTErr setTags(const TTValue& value);
79 
80  /** Setter for mPriority attribute. */
81  TTErr setPriority(const TTValue& value);
82 
83  /** Setter for mActive attribute. */
84  TTErr setActive(const TTValue& value);
85 
86  /** */
87  TTErr bind();
88 
89  /** */
90  TTErr unbind();
91 
92  /** cacheElement contains all info needed to handle all objects registered below this container in the directory
93  < object, observer1, observer2, node > */
94  TTErr makeCacheElement(TTNodePtr aNode);
95  TTErr deleteCacheElement(TTNodePtr aNode);
96  TTErr updateContent();
97 
98  /** Generates table heading for Datas */
99  void dataHeading(TTString *buffer);
100 
101  /** CSS definitions -- we include them in the html file itself so that we don't have problems with paths to external references */
102  void cssDefinition(TTString *buffer);
103 
104 
105  friend TTErr TTMODULAR_EXPORT TTContainerDirectoryCallback(const TTValue& baton, const TTValue& data);
106  friend TTErr TTMODULAR_EXPORT TTContainerValueAttributeCallback(const TTValue& baton, const TTValue& data);
107 };
108 
109 typedef TTContainer* TTContainerPtr;
110 
111 /**
112  @param baton ..
113  @param data ..
114  @return an error code */
115 TTErr TTMODULAR_EXPORT TTContainerDirectoryCallback(const TTValue& baton, const TTValue& data);
116 
117 /**
118  @param baton ..
119  @param data ..
120  @return an error code */
121 TTErr TTMODULAR_EXPORT TTContainerValueAttributeCallback(const TTValue& baton, const TTValue& data);
122 
123 /**
124  @param baton ..
125  @param data ..
126  @return an error code */
127 TTErr TTMODULAR_EXPORT TTContainerInitializedAttributeCallback(const TTValue& baton, const TTValue& data);
128 
129 /**
130  @param baton ..
131  @param data ..
132  @return an error code */
133 TTBoolean TTMODULAR_EXPORT TTContainerTestObjectAndContext(TTNodePtr n, TTPtr args);
134 
135 /** compare priority attribute of object's
136  @param v1 < relativeAddress, a pointer to a value containing a #TTObject >
137  @param v2 < relativeAddress, a pointer to a value containing a #TTObject >
138  @return is the priority of v1 is smaller than v2 (except if equal 0) ? */
139 TTBoolean TTMODULAR_EXPORT TTContainerCompareObjectPriority(TTValue& v1, TTValue& v2);
140 
141 
142 #endif // __TT_CONTAINER_H__
TTErr TTMODULAR_EXPORT TTContainerDirectoryCallback(const TTValue &baton, const TTValue &data)
TTContainer ...
Definition: TTContainer.h:27
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTBoolean TTMODULAR_EXPORT TTContainerCompareObjectPriority(TTValue &v1, TTValue &v2)
compare priority attribute of object's
TTModular Library.
TTErr TTMODULAR_EXPORT TTContainerValueAttributeCallback(const TTValue &baton, const TTValue &data)
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
Definition: TTNode.h:59
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
Create and use Jamoma object instances.
Definition: TTObject.h:29
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
Maintain a collection of TTValue objects indexed by TTSymbol pointers.
Definition: TTHash.h:36
TTBoolean TTMODULAR_EXPORT TTContainerTestObjectAndContext(TTNodePtr n, TTPtr args)
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
The TTString class is used to represent a string.
Definition: TTString.h:34
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTErr TTMODULAR_EXPORT TTContainerInitializedAttributeCallback(const TTValue &baton, const TTValue &data)