Acoustic Touch Recognition
OscTypes.h
Go to the documentation of this file.
1 /*
2  oscpack -- Open Sound Control (OSC) packet manipulation library
3  http://www.rossbencina.com/code/oscpack
4 
5  Copyright (c) 2004-2013 Ross Bencina <rossb@audiomulch.com>
6 
7  Permission is hereby granted, free of charge, to any person obtaining
8  a copy of this software and associated documentation files
9  (the "Software"), to deal in the Software without restriction,
10  including without limitation the rights to use, copy, modify, merge,
11  publish, distribute, sublicense, and/or sell copies of the Software,
12  and to permit persons to whom the Software is furnished to do so,
13  subject to the following conditions:
14 
15  The above copyright notice and this permission notice shall be
16  included in all copies or substantial portions of the Software.
17 
18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22  ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23  CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26 
27 /*
28  The text above constitutes the entire oscpack license; however,
29  the oscpack developer(s) also make the following non-binding requests:
30 
31  Any person wishing to distribute modifications to the Software is
32  requested to send the modifications to the original developer so that
33  they can be incorporated into the canonical version. It is also
34  requested that these non-binding requests be included whenever the
35  above license is reproduced.
36 */
37 #ifndef INCLUDED_OSCPACK_OSCTYPES_H
38 #define INCLUDED_OSCPACK_OSCTYPES_H
39 
40 
41 namespace osc{
42 
43 // basic types
44 
45 #if defined(__BORLANDC__) || defined(_MSC_VER)
46 
47 typedef __int64 int64;
48 typedef unsigned __int64 uint64;
49 
50 #elif defined(__x86_64__) || defined(_M_X64)
51 
52 typedef long int64;
53 typedef unsigned long uint64;
54 
55 #else
56 
57 typedef long long int64;
58 typedef unsigned long long uint64;
59 
60 #endif
61 
62 
63 
64 #if defined(__x86_64__) || defined(_M_X64)
65 
66 typedef signed int int32;
67 typedef unsigned int uint32;
68 
69 #else
70 
71 typedef signed long int32;
72 typedef unsigned long uint32;
73 
74 #endif
75 
76 
82 };
83 
84 
85 // osc_bundle_element_size_t is used for the size of bundle elements and blobs
86 // the OSC spec specifies these as int32 (signed) but we ensure that they
87 // are always positive since negative field sizes make no sense.
88 
90 
91 enum {
92  OSC_INT32_MAX = 0x7FFFFFFF,
93 
94  // Element sizes are specified to be int32, and are always rounded up to nearest
95  // multiple of 4. Therefore their values can't be greater than 0x7FFFFFFC.
97 };
98 
99 
100 inline bool IsValidElementSizeValue( osc_bundle_element_size_t x )
101 {
102  // sizes may not be negative or exceed OSC_BUNDLE_ELEMENT_SIZE_MAX
103  return x >= 0 && x <= OSC_BUNDLE_ELEMENT_SIZE_MAX;
104 }
105 
106 
107 inline bool IsMultipleOf4( osc_bundle_element_size_t x )
108 {
109  return (x & ((osc_bundle_element_size_t)0x03)) == 0;
110 }
111 
112 
131 };
132 
133 
134 
135 // i/o manipulators used for streaming interfaces
136 
138  explicit BundleInitiator( uint64 timeTag_ ) : timeTag( timeTag_ ) {}
139  uint64 timeTag;
140 };
141 
143 
145 {
146  return BundleInitiator(timeTag);
147 }
148 
149 
151 };
152 
154 
156  explicit BeginMessage( const char *addressPattern_ ) : addressPattern( addressPattern_ ) {}
157  const char *addressPattern;
158 };
159 
161 };
162 
164 
165 
166 // osc specific types. they are defined as structs so they can be used
167 // as separately identifiable types with the streaming operators.
168 
169 struct NilType{
170 };
171 
172 extern NilType OscNil;
173 
174 #ifndef _OBJC_OBJC_H_
175 extern NilType Nil; // Objective-C defines Nil. so our Nil is deprecated. use OscNil instead
176 #endif
177 
179 };
180 
181 extern InfinitumType Infinitum;
182 
183 struct RgbaColor{
185  explicit RgbaColor( uint32 value_ ) : value( value_ ) {}
186  uint32 value;
187 
188  operator uint32() const { return value; }
189 };
190 
191 
192 struct MidiMessage{
194  explicit MidiMessage( uint32 value_ ) : value( value_ ) {}
195  uint32 value;
196 
197  operator uint32() const { return value; }
198 };
199 
200 
201 struct TimeTag{
202  TimeTag() {}
203  explicit TimeTag( uint64 value_ ) : value( value_ ) {}
204  uint64 value;
205 
206  operator uint64() const { return value; }
207 };
208 
209 
210 struct Symbol{
211  Symbol() {}
212  explicit Symbol( const char* value_ ) : value( value_ ) {}
213  const char* value;
214 
215  operator const char *() const { return value; }
216 };
217 
218 
219 struct Blob{
220  Blob() {}
221  explicit Blob( const void* data_, osc_bundle_element_size_t size_ )
222  : data( data_ ), size( size_ ) {}
223  const void* data;
224  osc_bundle_element_size_t size;
225 };
226 
228 };
229 
231 
233 };
234 
236 
237 } // namespace osc
238 
239 
240 #endif /* INCLUDED_OSCPACK_OSCTYPES_H */
uint64 timeTag
Definition: OscTypes.h:139
RgbaColor()
Definition: OscTypes.h:184
bool IsValidElementSizeValue(osc_bundle_element_size_t x)
Definition: OscTypes.h:100
uint64 value
Definition: OscTypes.h:204
Definition: OscTypes.h:81
Definition: OscTypes.h:169
long long int64
Definition: OscTypes.h:57
const void * data
Definition: OscTypes.h:223
Definition: OscTypes.h:183
Blob()
Definition: OscTypes.h:220
Definition: OscTypes.h:78
Definition: OscTypes.h:129
BeginMessage(const char *addressPattern_)
Definition: OscTypes.h:156
Definition: OscTypes.h:118
ArrayInitiator BeginArray
Definition: OscTypes.cpp:49
InfinitumType Infinitum
Definition: OscTypes.cpp:48
unsigned long long uint64
Definition: OscTypes.h:58
Definition: OscTypes.h:137
Definition: OscTypes.h:120
Definition: OscTypes.h:232
Definition: OscTypes.h:80
Definition: OscTypes.h:123
TypeTagValues
Definition: OscTypes.h:113
Definition: OscTypes.h:126
Definition: OscTypes.h:115
const char * addressPattern
Definition: OscTypes.h:157
MidiMessage(uint32 value_)
Definition: OscTypes.h:194
Definition: OscTypes.h:128
Definition: OscTypes.h:119
Definition: OscTypes.h:160
BundleTerminator EndBundle
Definition: OscTypes.cpp:42
Definition: OscTypes.h:124
Definition: OscTypes.h:178
Definition: OscTypes.h:150
Symbol()
Definition: OscTypes.h:211
Definition: OscTypes.h:210
Definition: OscTypes.h:79
uint32 value
Definition: OscTypes.h:186
NilType Nil
Definition: OscTypes.cpp:46
BundleInitiator BeginBundle(uint64 timeTag=1)
Definition: OscTypes.h:144
int32 osc_bundle_element_size_t
Definition: OscTypes.h:89
Definition: OscTypes.h:201
Blob(const void *data_, osc_bundle_element_size_t size_)
Definition: OscTypes.h:221
Definition: OscTypes.h:122
uint32 value
Definition: OscTypes.h:195
Definition: OscTypes.h:130
Definition: OscTypes.h:96
BundleInitiator(uint64 timeTag_)
Definition: OscTypes.h:138
Definition: OscTypes.h:92
signed long int32
Definition: OscTypes.h:71
Definition: MessageMappingOscPacketListener.h:47
RgbaColor(uint32 value_)
Definition: OscTypes.h:185
Definition: OscTypes.h:121
Definition: OscTypes.h:117
MessageTerminator EndMessage
Definition: OscTypes.cpp:43
Definition: OscTypes.h:219
Definition: OscTypes.h:155
BundleInitiator BeginBundleImmediate
NilType OscNil
Definition: OscTypes.cpp:44
Definition: OscTypes.h:116
Symbol(const char *value_)
Definition: OscTypes.h:212
TimeTag(uint64 value_)
Definition: OscTypes.h:203
Definition: OscTypes.h:114
ArrayTerminator EndArray
Definition: OscTypes.cpp:50
ValueTypeSizes
Definition: OscTypes.h:77
bool IsMultipleOf4(osc_bundle_element_size_t x)
Definition: OscTypes.h:107
osc_bundle_element_size_t size
Definition: OscTypes.h:224
Definition: OscTypes.h:127
unsigned long uint32
Definition: OscTypes.h:72
const char * value
Definition: OscTypes.h:213
Definition: OscTypes.h:125
Definition: OscTypes.h:192
TimeTag()
Definition: OscTypes.h:202
MidiMessage()
Definition: OscTypes.h:193
Definition: OscTypes.h:227