Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpreter / preprocessor / faust-0.9.47mr3 / architecture / osclib / faust / src / nodes / RootNode.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 __RootNode__
26 #define __RootNode__
27
28 #include <string>
29 #include <vector>
30
31 #include "MessageDriven.h"
32
33 namespace oscfaust
34 {
35
36 class OSCIO;
37 class RootNode;
38 typedef class SMARTP<RootNode> SRootNode;
39
40 //--------------------------------------------------------------------------
41 /*!
42 \brief a faust root node
43
44 A Faust root node handles the \c 'hello' message and provides support
45 for incoming osc signal data.
46 */
47 class RootNode : public MessageDriven
48 {
49 int *fUPDIn, *fUDPOut, *fUDPErr; // the osc port numbers (required by the hello method)
50 OSCIO * fIO; // an OSC IO controler
51
52 protected:
53 RootNode(const char *name, OSCIO* io=0) : MessageDriven (name, ""), fUPDIn(0), fUDPOut(0), fUDPErr(0), fIO(io) {}
54 virtual ~RootNode() {}
55
56 public:
57 static SRootNode create (const char* name, OSCIO* io=0) { return new RootNode(name, io); }
58
59 virtual bool accept( const Message* msg );
60
61 bool acceptSignal( const Message* msg ); ///< handler for signal data
62 void hello (unsigned long ipdest) const; ///< handler for the 'hello' message
63 void setPorts (int* in, int* out, int* err);
64 };
65
66 } // end namespoace
67
68 #endif