Jamoma API  0.6.0.a19
TTExplorer.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularLibrary
4  *
5  * @brief A Namespace Explorer 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_EXPLORER_H__
18 #define __TT_EXPLORER_H__
19 
20 #include "TTModularIncludes.h"
21 
22 
23 /** TTExplorer ... TODO : an explanation
24 
25 
26  */
27 
28 class TTMODULAR_EXPORT TTExplorer : public TTObjectBase
29 {
31 
32 private:
33 
34  TTSymbol mNamespace; ///< ATTRIBUTE : the name of the namespace selection to manage
35  TTAddress mAddress; ///< ATTRIBUTE : the node where to start the exploration (default : the local root)
36  TTSymbol mOutput; ///< ATTRIBUTE : what returns the exploration from the node :
37  ///< - descendants : any address below the node at any level (default)
38  ///< - children : all children of the node
39  ///< - brothers : all instances of the node
40  ///< - attributes : all attributes of the node
41 
42  TTBoolean mUpdate; ///< ATTRIBUTE : is the explorer listen to the namespace to update the result ?
43 
44  TTSymbol mSort; ///< ATTRIBUTE : to sort the result : none, alphabetic, priority (default : alphabetic)
45 
46  TTUInt8 mDepth; ///< ATTRIBUTE : a depth limit for the exploration (only usefull for descendants mode)
47 
48  TTNodeDirectoryPtr mDirectory; ///< an explorer depends on a directory
49 
50  TTObject mAddressObserver; ///< an address life cycle observer
51  TTObject mApplicationObserver; ///< an application life cycle observer
52  TTObject mReturnValueCallback; ///< a way to return back value to the owner of this explorer
53  TTObject mReturnSelectionCallback; ///< a way to return back selection to the owner of this explorer
54  TTHashPtr mFilterBank; ///< a hash table containing TTDictionaryBasePtr to store filters
55  TTListPtr mFilterList; ///< a list containing TTSymbol to retreive filters in the filter bank
56 
57  TTNodePtr mTempNode; ///< remember the node on which the exploration have been done (Children cases)
58  TTHashPtr mResult; ///< hash table containing all elements found by the explorer
59  TTValue mLastResult; ///< keep the last result to filter unchanged list
60 
61  /** */
62  TTErr Explore();
63 
64  /** Set the selection state of a namespace item using his name and a new selection state
65  if no selection state : switch the state */
66  TTErr Select(const TTValue& inputValue, TTValue& outputValue);
67 
68  /** Set all selection state to YES */
69  TTErr SelectAll();
70 
71  /** Set all selection state to NO */
72  TTErr SelectNone();
73 
74  /** Return selection back to the owner of this explorer */
75  TTErr SelectionRefresh();
76 
77  /** Create a filter, add it to the bank and append it to the list
78  < filterName filterKey1 filterValue1 filterKey2 filterValue2 ... >
79  note : the schema of the filter is automatically detected by the keys */
80  TTErr FilterSet(const TTValue& inputValue, TTValue& outputValue);
81 
82  /** Delete a filter from the bank using his name and remove it from the filter list */
83  TTErr FilterRemove(const TTValue& inputValue, TTValue& outputValue);
84 
85  /** Get info about a filter or a filterKey
86  < filterName filterKey1 filterValue1 filterKey2 filterValue2 ... > */
87  TTErr FilterInfo(const TTValue& inputValue, TTValue& outputValue);
88 
89  /** */
90  // TODO : TTErr Dump();
91 
92  /** */
93  TTErr setNamespace(const TTValue& value);
94 
95  /** */
96  TTErr getFilterList(TTValue& value);
97 
98  /** */
99  TTErr setFilterList(const TTValue& value);
100 
101  /** */
102  TTErr setOutput(const TTValue& value);
103 
104  /** */
105  TTErr setAddress(const TTValue& value);
106 
107  /** */
108  TTErr setUpdate(const TTValue& value);
109 
110  /** */
111  TTErr setSort(const TTValue& value);
112 
113  /** */
114  TTErr setDepth(const TTValue& value);
115 
116  /** */
117  TTErr getObjectsByType(TTValue& value);
118 
119  /** */
120  TTErr bindAddress();
121 
122  /** */
123  TTErr unbindAddress();
124 
125  /** */
126  TTErr bindApplication();
127 
128  /** */
129  TTErr unbindApplication();
130 
131  /** */
132  TTErr returnResultBack();
133 
134  /** */
135  TTErr returnSelectionBack();
136 
137  friend TTErr TTMODULAR_EXPORT TTExplorerDirectoryCallback(const TTValue& baton, const TTValue& data);
138  friend TTErr TTMODULAR_EXPORT TTExplorerApplicationManagerCallback(const TTValue& baton, const TTValue& data);
139 };
140 
141 typedef TTExplorer* TTExplorerPtr;
142 
143 /**
144  @param baton ..
145  @param data ..
146  @return an error code */
147 TTErr TTMODULAR_EXPORT TTExplorerDirectoryCallback(const TTValue& baton, const TTValue& data);
148 
149 /**
150  @param baton ..
151  @param data ..
152  @return an error code */
153 TTErr TTMODULAR_EXPORT TTExplorerApplicationManagerCallback(const TTValue& baton, const TTValue& data);
154 
155 /** compare priority attribute of object's node
156  @param v1 < relativeAddress, a pointer to a value containing a pointer to a TTNode >
157  @param v2 < relativeAddress, a pointer to a value containing a pointer to a TTNode >
158  @return is the priority of v1 is smaller than v2 (except if equal 0) ? */
159 TTBoolean TTMODULAR_EXPORT TTExplorerCompareNodePriority(TTValue& v1, TTValue& v2);
160 
161 #endif // __TT_EXPLORER_H__
TTExplorer ...
Definition: TTExplorer.h:28
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTModular Library.
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
Definition: TTNode.h:59
TTBoolean TTMODULAR_EXPORT TTExplorerCompareNodePriority(TTValue &v1, TTValue &v2)
compare priority attribute of object's node
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
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
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr TTMODULAR_EXPORT TTExplorerApplicationManagerCallback(const TTValue &baton, const TTValue &data)
Definition: TTExplorer.cpp:968
TTErr TTMODULAR_EXPORT TTExplorerDirectoryCallback(const TTValue &baton, const TTValue &data)
Definition: TTExplorer.cpp:867
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
We build a tree of TTNodes, and you can request a pointer for any TTNode, or add an observer to any T...
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
unsigned char TTUInt8
8 bit unsigned integer (char)
Definition: TTBase.h:174