TUIO C++ Developer API
TuioClient.h
1 /*
2  TUIO C++ Library
3  Copyright (c) 2005-2017 Martin Kaltenbrunner <martin@tuio.org>
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 3.0 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.
17 */
18 
19 #ifndef INCLUDED_TUIOCLIENT_H
20 #define INCLUDED_TUIOCLIENT_H
21 
22 #include "TuioDispatcher.h"
23 #include "OscReceiver.h"
24 #include "osc/OscReceivedElements.h"
25 
26 #include <iostream>
27 #include <list>
28 #include <map>
29 #include <algorithm>
30 #include <string>
31 #include <cstring>
32 
33 namespace TUIO {
34 
35  class OscReceiver; // Forward declaration
36 
50  class LIBDECL TuioClient : public TuioDispatcher {
51 
52  public:
57  TuioClient();
58 
64  TuioClient(int port);
65 
71  TuioClient(OscReceiver *oscreceiver);
72 
76  ~TuioClient();
77 
83  void connect(bool lock=false);
84 
88  void disconnect();
89 
94  bool isConnected();
95 
101  std::list<TuioObject*> getTuioObjects() {
103  }
104 
112  std::list<TuioObject*> getTuioObjects(int source_id);
113 
121  std::list<TuioObject> copyTuioObjects(int source_id);
122 
123 
129  std::list<TuioObject> copyTuioObjects() {
131  }
132 
140  TuioObject* getTuioObject(long s_id) {
141  return getTuioObject(0,s_id);
142  };
143 
153  TuioObject* getTuioObject(int src_id, long s_id);
154 
160  std::list<TuioCursor*> getTuioCursors() {
162  }
163 
171  std::list<TuioCursor*> getTuioCursors(int source_id);
172 
178  std::list<TuioCursor> copyTuioCursors() {
180  }
181 
189  std::list<TuioCursor> copyTuioCursors(int source_id);
190 
198  TuioCursor* getTuioCursor(long s_id) {
199  return getTuioCursor(0,s_id);
200  };
201 
211  TuioCursor* getTuioCursor(int src_id, long s_id);
212 
218  std::list<TuioBlob*> getTuioBlobs() {
220  }
221 
229  std::list<TuioBlob*> getTuioBlobs(int source_id);
230 
236  std::list<TuioBlob> copyTuioBlobs() {
238  }
239 
247  std::list<TuioBlob> copyTuioBlobs(int source_id);
248 
256  TuioBlob* getTuioBlob(long s_id) {
257  return getTuioBlob(0,s_id);
258  };
259 
269  TuioBlob* getTuioBlob(int src_id, long s_id);
270 
271  void processOSC( const osc::ReceivedMessage& message);
272 
273  private:
274  void initialize();
275 
276  std::list<TuioObject*> frameObjects;
277  std::list<long> aliveObjectList;
278  std::list<TuioCursor*> frameCursors;
279  std::list<long> aliveCursorList;
280  std::list<TuioBlob*> frameBlobs;
281  std::list<long> aliveBlobList;
282 
283  osc::int32 currentFrame;
284  TuioTime currentTime;
285 
286  std::list<TuioCursor*> freeCursorList, freeCursorBuffer;
287  std::map<int,int> maxCursorID;
288 
289  std::list<TuioBlob*> freeBlobList, freeBlobBuffer;
290  std::map<int,int> maxBlobID;
291 
292  std::map<std::string,int> sourceList;
293  int source_id;
294  char *source_name;
295  char *source_addr;
296 
297  OscReceiver *receiver;
298  bool local_receiver;
299  };
300 };
301 #endif /* INCLUDED_TUIOCLIENT_H */
std::list< TuioBlob > copyTuioBlobs()
Definition: TuioClient.h:236
std::list< TuioBlob > copyTuioBlobs()
Definition: TuioDispatcher.cpp:200
std::list< TuioBlob * > getTuioBlobs()
Definition: TuioDispatcher.cpp:168
std::list< TuioObject > copyTuioObjects()
Definition: TuioDispatcher.cpp:177
std::list< TuioCursor > copyTuioCursors()
Definition: TuioClient.h:178
Definition: TuioTime.h:48
std::list< TuioCursor * > getTuioCursors()
Definition: TuioClient.h:160
std::list< TuioObject > copyTuioObjects()
Definition: TuioClient.h:129
TuioCursor * getTuioCursor(long s_id)
Definition: TuioClient.h:198
Definition: FlashSender.h:166
Definition: OscReceiver.h:40
Definition: TuioObject.h:32
std::list< TuioObject * > getTuioObjects()
Definition: TuioClient.h:101
std::list< TuioCursor * > getTuioCursors()
Definition: TuioDispatcher.cpp:159
Definition: TuioDispatcher.h:39
Definition: TuioClient.h:50
TuioObject * getTuioObject(long s_id)
Definition: TuioClient.h:140
Definition: TuioBlob.h:32
std::list< TuioBlob * > getTuioBlobs()
Definition: TuioClient.h:218
std::list< TuioObject * > getTuioObjects()
Definition: TuioDispatcher.cpp:150
TuioBlob * getTuioBlob(long s_id)
Definition: TuioClient.h:256
Definition: TuioCursor.h:32
std::list< TuioCursor > copyTuioCursors()
Definition: TuioDispatcher.cpp:188