Install, Readme and Changes files updated. Documentation removed.
[Faustine.git] / interpretor / faust-0.9.47mr3 / architecture / osclib / faust / src / nodes / FaustFactory.h
1 /*
2
3 Copyright (C) 2011 Grame
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
20 research@grame.fr
21
22 */
23
24
25 #ifndef __FaustFactory__
26 #define __FaustFactory__
27
28 #include <stack>
29 #include <string>
30
31 #include "MessageDriven.h"
32
33 namespace oscfaust
34 {
35
36 class OSCIO;
37 class MessageDriven;
38 typedef class SMARTP<MessageDriven> SMessageDriven;
39
40 //--------------------------------------------------------------------------
41 /*!
42 \brief a factory to build a OSC UI hierarchy
43
44 Actually, makes use of a stack to build the UI hierarchy.
45 It includes a pointer to a OSCIO controler, but just to give it to the root node.
46 */
47 class FaustFactory
48 {
49 std::stack<SMessageDriven> fNodes; ///< maintains the current hierarchy level
50 SMessageDriven fRoot; ///< keep track of the root node
51 OSCIO * fIO; ///< hack to support audio IO via OSC, actually the field is given to the root node
52
53 private:
54 SMessageDriven followPath (SMessageDriven fRoot, const std::string& fullpath, std::string& pathtoleaf);
55 void createNodeChain (SMessageDriven node, const std::string& pathtoleaf, float* zone, float imin, float imax, float init, float min, float max);
56
57 public:
58 FaustFactory(OSCIO * io=0) : fIO(io) {}
59 virtual ~FaustFactory() {}
60
61 void addnode (const char* label, float* zone, float init, float min, float max);
62 void addfullpathnode (const std::string& fullpath, float* zone, float imin, float imax, float init, float min, float max);
63 void opengroup (const char* label);
64 void closegroup ();
65
66 SMessageDriven root() const { return fRoot; }
67 };
68
69 } // end namespoace
70
71 #endif