annotate external/oscpack/osc/OscTypes.h @ 648:1c2a5868f23a

Fix memory leak in CARFAC. Also get rid of most uses of auto, which tend to hurt readability unless the type name is particularly long, especially when it masks pointers.
author ronw@google.com
date Tue, 11 Jun 2013 21:41:53 +0000
parents 0284d2152e17
children
rev   line source
tomwalters@509 1 /*
tomwalters@509 2 oscpack -- Open Sound Control packet manipulation library
tomwalters@509 3 http://www.audiomulch.com/~rossb/oscpack
tomwalters@509 4
tomwalters@509 5 Copyright (c) 2004-2005 Ross Bencina <rossb@audiomulch.com>
tomwalters@509 6
tomwalters@509 7 Permission is hereby granted, free of charge, to any person obtaining
tomwalters@509 8 a copy of this software and associated documentation files
tomwalters@509 9 (the "Software"), to deal in the Software without restriction,
tomwalters@509 10 including without limitation the rights to use, copy, modify, merge,
tomwalters@509 11 publish, distribute, sublicense, and/or sell copies of the Software,
tomwalters@509 12 and to permit persons to whom the Software is furnished to do so,
tomwalters@509 13 subject to the following conditions:
tomwalters@509 14
tomwalters@509 15 The above copyright notice and this permission notice shall be
tomwalters@509 16 included in all copies or substantial portions of the Software.
tomwalters@509 17
tomwalters@509 18 Any person wishing to distribute modifications to the Software is
tomwalters@509 19 requested to send the modifications to the original developer so that
tomwalters@509 20 they can be incorporated into the canonical version.
tomwalters@509 21
tomwalters@509 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
tomwalters@509 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
tomwalters@509 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
tomwalters@509 25 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
tomwalters@509 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
tomwalters@509 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
tomwalters@509 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tomwalters@509 29 */
tomwalters@509 30 #ifndef INCLUDED_OSCTYPES_H
tomwalters@509 31 #define INCLUDED_OSCTYPES_H
tomwalters@509 32
tomwalters@509 33
tomwalters@509 34 namespace osc{
tomwalters@509 35
tomwalters@509 36 // basic types
tomwalters@509 37
tomwalters@509 38 #if defined(__BORLANDC__) || defined(_MSC_VER)
tomwalters@509 39
tomwalters@509 40 typedef __int64 int64;
tomwalters@509 41 typedef unsigned __int64 uint64;
tomwalters@509 42
tomwalters@509 43 #else
tomwalters@509 44
tomwalters@509 45 typedef long long int64;
tomwalters@509 46 typedef unsigned long long uint64;
tomwalters@509 47
tomwalters@509 48 #endif
tomwalters@509 49
tomwalters@509 50
tomwalters@509 51
tomwalters@509 52 #ifdef x86_64
tomwalters@509 53
tomwalters@509 54 typedef signed int int32;
tomwalters@509 55 typedef unsigned int uint32;
tomwalters@509 56
tomwalters@509 57 #else
tomwalters@509 58
tomwalters@509 59 typedef signed long int32;
tomwalters@509 60 typedef unsigned long uint32;
tomwalters@509 61
tomwalters@509 62 #endif
tomwalters@509 63
tomwalters@509 64
tomwalters@509 65
tomwalters@509 66 enum TypeTagValues {
tomwalters@509 67 TRUE_TYPE_TAG = 'T',
tomwalters@509 68 FALSE_TYPE_TAG = 'F',
tomwalters@509 69 NIL_TYPE_TAG = 'N',
tomwalters@509 70 INFINITUM_TYPE_TAG = 'I',
tomwalters@509 71 INT32_TYPE_TAG = 'i',
tomwalters@509 72 FLOAT_TYPE_TAG = 'f',
tomwalters@509 73 CHAR_TYPE_TAG = 'c',
tomwalters@509 74 RGBA_COLOR_TYPE_TAG = 'r',
tomwalters@509 75 MIDI_MESSAGE_TYPE_TAG = 'm',
tomwalters@509 76 INT64_TYPE_TAG = 'h',
tomwalters@509 77 TIME_TAG_TYPE_TAG = 't',
tomwalters@509 78 DOUBLE_TYPE_TAG = 'd',
tomwalters@509 79 STRING_TYPE_TAG = 's',
tomwalters@509 80 SYMBOL_TYPE_TAG = 'S',
tomwalters@509 81 BLOB_TYPE_TAG = 'b'
tomwalters@509 82 };
tomwalters@509 83
tomwalters@509 84
tomwalters@509 85
tomwalters@509 86 // i/o manipulators used for streaming interfaces
tomwalters@509 87
tomwalters@509 88 struct BundleInitiator{
tomwalters@509 89 explicit BundleInitiator( uint64 timeTag_ ) : timeTag( timeTag_ ) {}
tomwalters@509 90 uint64 timeTag;
tomwalters@509 91 };
tomwalters@509 92
tomwalters@509 93 extern BundleInitiator BeginBundleImmediate;
tomwalters@509 94
tomwalters@509 95 inline BundleInitiator BeginBundle( uint64 timeTag=1 )
tomwalters@509 96 {
tomwalters@509 97 return BundleInitiator(timeTag);
tomwalters@509 98 }
tomwalters@509 99
tomwalters@509 100
tomwalters@509 101 struct BundleTerminator{
tomwalters@509 102 };
tomwalters@509 103
tomwalters@509 104 extern BundleTerminator EndBundle;
tomwalters@509 105
tomwalters@509 106 struct BeginMessage{
tomwalters@509 107 explicit BeginMessage( const char *addressPattern_ ) : addressPattern( addressPattern_ ) {}
tomwalters@509 108 const char *addressPattern;
tomwalters@509 109 };
tomwalters@509 110
tomwalters@509 111 struct MessageTerminator{
tomwalters@509 112 };
tomwalters@509 113
tomwalters@509 114 extern MessageTerminator EndMessage;
tomwalters@509 115
tomwalters@509 116
tomwalters@509 117 // osc specific types. they are defined as structs so they can be used
tomwalters@509 118 // as separately identifiable types with the streaming operators.
tomwalters@509 119
tomwalters@509 120 struct NilType{
tomwalters@509 121 };
tomwalters@509 122
tomwalters@509 123 extern NilType Nil;
tomwalters@509 124
tomwalters@509 125
tomwalters@509 126 struct InfinitumType{
tomwalters@509 127 };
tomwalters@509 128
tomwalters@509 129 extern InfinitumType Infinitum;
tomwalters@509 130
tomwalters@509 131 struct RgbaColor{
tomwalters@509 132 RgbaColor() {}
tomwalters@509 133 explicit RgbaColor( uint32 value_ ) : value( value_ ) {}
tomwalters@509 134 uint32 value;
tomwalters@509 135
tomwalters@509 136 operator uint32() const { return value; }
tomwalters@509 137 };
tomwalters@509 138
tomwalters@509 139
tomwalters@509 140 struct MidiMessage{
tomwalters@509 141 MidiMessage() {}
tomwalters@509 142 explicit MidiMessage( uint32 value_ ) : value( value_ ) {}
tomwalters@509 143 uint32 value;
tomwalters@509 144
tomwalters@509 145 operator uint32() const { return value; }
tomwalters@509 146 };
tomwalters@509 147
tomwalters@509 148
tomwalters@509 149 struct TimeTag{
tomwalters@509 150 TimeTag() {}
tomwalters@509 151 explicit TimeTag( uint64 value_ ) : value( value_ ) {}
tomwalters@509 152 uint64 value;
tomwalters@509 153
tomwalters@509 154 operator uint64() const { return value; }
tomwalters@509 155 };
tomwalters@509 156
tomwalters@509 157
tomwalters@509 158 struct Symbol{
tomwalters@509 159 Symbol() {}
tomwalters@509 160 explicit Symbol( const char* value_ ) : value( value_ ) {}
tomwalters@509 161 const char* value;
tomwalters@509 162
tomwalters@509 163 operator const char *() const { return value; }
tomwalters@509 164 };
tomwalters@509 165
tomwalters@509 166
tomwalters@509 167 struct Blob{
tomwalters@509 168 Blob() {}
tomwalters@509 169 explicit Blob( const void* data_, unsigned long size_ )
tomwalters@509 170 : data( data_ ), size( size_ ) {}
tomwalters@509 171 const void* data;
tomwalters@509 172 unsigned long size;
tomwalters@509 173 };
tomwalters@509 174
tomwalters@509 175 } // namespace osc
tomwalters@509 176
tomwalters@509 177
tomwalters@509 178 #endif /* INCLUDED_OSCTYPES_H */