TUIO C++ Developer API
TuioDispatcher.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_TUIODISPATCHER_H
20 #define INCLUDED_TUIODISPATCHER_H
21 
22 #include "TuioListener.h"
23 
24 #ifdef WIN32
25 #include <windows.h>
26 #else
27 #include <pthread.h>
28 #endif
29 
30 namespace TUIO {
31 
39  class LIBDECL TuioDispatcher {
40 
41  public:
47 
51  ~TuioDispatcher();
52 
58  void addTuioListener(TuioListener *listener);
59 
65  void removeTuioListener(TuioListener *listener);
66 
70  void removeAllTuioListeners();
71 
77  std::list<TuioObject*> getTuioObjects();
78 
84  std::list<TuioObject> copyTuioObjects();
85 
91  std::list<TuioCursor*> getTuioCursors();
92 
98  std::list<TuioCursor> copyTuioCursors();
99 
105  std::list<TuioBlob*> getTuioBlobs();
106 
112  std::list<TuioBlob> copyTuioBlobs();
113 
120  TuioObject* getTuioObject(long s_id);
121 
128  TuioCursor* getTuioCursor(long s_id);
129 
136  TuioBlob* getTuioBlob(long s_id);
137 
141  void lockObjectList();
142 
146  void unlockObjectList();
147 
151  void lockCursorList();
152 
156  void unlockCursorList();
157 
161  void lockBlobList();
162 
166  void unlockBlobList();
167 
168  protected:
169  std::list<TuioListener*> listenerList;
170 
171  std::list<TuioObject*> objectList;
172  std::list<TuioCursor*> cursorList;
173  std::list<TuioBlob*> blobList;
174 
175 #ifdef WIN32
176  HANDLE objectMutex;
177  HANDLE cursorMutex;
178  HANDLE blobMutex;
179 #else
180  pthread_mutex_t objectMutex;
181  pthread_mutex_t cursorMutex;
182  pthread_mutex_t blobMutex;
183 #endif
184 
185  };
186 }
187 #endif /* INCLUDED_TUIODISPATCHER_H */
Definition: FlashSender.h:166
Definition: TuioObject.h:32
Definition: TuioDispatcher.h:39
Definition: TuioListener.h:45
Definition: TuioBlob.h:32
Definition: TuioCursor.h:32