tomwalters@509: /* tomwalters@509: oscpack -- Open Sound Control packet manipulation library tomwalters@509: http://www.audiomulch.com/~rossb/oscpack tomwalters@509: tomwalters@509: Copyright (c) 2004-2005 Ross Bencina tomwalters@509: tomwalters@509: Permission is hereby granted, free of charge, to any person obtaining tomwalters@509: a copy of this software and associated documentation files tomwalters@509: (the "Software"), to deal in the Software without restriction, tomwalters@509: including without limitation the rights to use, copy, modify, merge, tomwalters@509: publish, distribute, sublicense, and/or sell copies of the Software, tomwalters@509: and to permit persons to whom the Software is furnished to do so, tomwalters@509: subject to the following conditions: tomwalters@509: tomwalters@509: The above copyright notice and this permission notice shall be tomwalters@509: included in all copies or substantial portions of the Software. tomwalters@509: tomwalters@509: Any person wishing to distribute modifications to the Software is tomwalters@509: requested to send the modifications to the original developer so that tomwalters@509: they can be incorporated into the canonical version. tomwalters@509: tomwalters@509: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, tomwalters@509: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF tomwalters@509: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. tomwalters@509: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR tomwalters@509: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF tomwalters@509: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION tomwalters@509: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. tomwalters@509: */ tomwalters@509: #ifndef INCLUDED_OSCTYPES_H tomwalters@509: #define INCLUDED_OSCTYPES_H tomwalters@509: tomwalters@509: tomwalters@509: namespace osc{ tomwalters@509: tomwalters@509: // basic types tomwalters@509: tomwalters@509: #if defined(__BORLANDC__) || defined(_MSC_VER) tomwalters@509: tomwalters@509: typedef __int64 int64; tomwalters@509: typedef unsigned __int64 uint64; tomwalters@509: tomwalters@509: #else tomwalters@509: tomwalters@509: typedef long long int64; tomwalters@509: typedef unsigned long long uint64; tomwalters@509: tomwalters@509: #endif tomwalters@509: tomwalters@509: tomwalters@509: tomwalters@509: #ifdef x86_64 tomwalters@509: tomwalters@509: typedef signed int int32; tomwalters@509: typedef unsigned int uint32; tomwalters@509: tomwalters@509: #else tomwalters@509: tomwalters@509: typedef signed long int32; tomwalters@509: typedef unsigned long uint32; tomwalters@509: tomwalters@509: #endif tomwalters@509: tomwalters@509: tomwalters@509: tomwalters@509: enum TypeTagValues { tomwalters@509: TRUE_TYPE_TAG = 'T', tomwalters@509: FALSE_TYPE_TAG = 'F', tomwalters@509: NIL_TYPE_TAG = 'N', tomwalters@509: INFINITUM_TYPE_TAG = 'I', tomwalters@509: INT32_TYPE_TAG = 'i', tomwalters@509: FLOAT_TYPE_TAG = 'f', tomwalters@509: CHAR_TYPE_TAG = 'c', tomwalters@509: RGBA_COLOR_TYPE_TAG = 'r', tomwalters@509: MIDI_MESSAGE_TYPE_TAG = 'm', tomwalters@509: INT64_TYPE_TAG = 'h', tomwalters@509: TIME_TAG_TYPE_TAG = 't', tomwalters@509: DOUBLE_TYPE_TAG = 'd', tomwalters@509: STRING_TYPE_TAG = 's', tomwalters@509: SYMBOL_TYPE_TAG = 'S', tomwalters@509: BLOB_TYPE_TAG = 'b' tomwalters@509: }; tomwalters@509: tomwalters@509: tomwalters@509: tomwalters@509: // i/o manipulators used for streaming interfaces tomwalters@509: tomwalters@509: struct BundleInitiator{ tomwalters@509: explicit BundleInitiator( uint64 timeTag_ ) : timeTag( timeTag_ ) {} tomwalters@509: uint64 timeTag; tomwalters@509: }; tomwalters@509: tomwalters@509: extern BundleInitiator BeginBundleImmediate; tomwalters@509: tomwalters@509: inline BundleInitiator BeginBundle( uint64 timeTag=1 ) tomwalters@509: { tomwalters@509: return BundleInitiator(timeTag); tomwalters@509: } tomwalters@509: tomwalters@509: tomwalters@509: struct BundleTerminator{ tomwalters@509: }; tomwalters@509: tomwalters@509: extern BundleTerminator EndBundle; tomwalters@509: tomwalters@509: struct BeginMessage{ tomwalters@509: explicit BeginMessage( const char *addressPattern_ ) : addressPattern( addressPattern_ ) {} tomwalters@509: const char *addressPattern; tomwalters@509: }; tomwalters@509: tomwalters@509: struct MessageTerminator{ tomwalters@509: }; tomwalters@509: tomwalters@509: extern MessageTerminator EndMessage; tomwalters@509: tomwalters@509: tomwalters@509: // osc specific types. they are defined as structs so they can be used tomwalters@509: // as separately identifiable types with the streaming operators. tomwalters@509: tomwalters@509: struct NilType{ tomwalters@509: }; tomwalters@509: tomwalters@509: extern NilType Nil; tomwalters@509: tomwalters@509: tomwalters@509: struct InfinitumType{ tomwalters@509: }; tomwalters@509: tomwalters@509: extern InfinitumType Infinitum; tomwalters@509: tomwalters@509: struct RgbaColor{ tomwalters@509: RgbaColor() {} tomwalters@509: explicit RgbaColor( uint32 value_ ) : value( value_ ) {} tomwalters@509: uint32 value; tomwalters@509: tomwalters@509: operator uint32() const { return value; } tomwalters@509: }; tomwalters@509: tomwalters@509: tomwalters@509: struct MidiMessage{ tomwalters@509: MidiMessage() {} tomwalters@509: explicit MidiMessage( uint32 value_ ) : value( value_ ) {} tomwalters@509: uint32 value; tomwalters@509: tomwalters@509: operator uint32() const { return value; } tomwalters@509: }; tomwalters@509: tomwalters@509: tomwalters@509: struct TimeTag{ tomwalters@509: TimeTag() {} tomwalters@509: explicit TimeTag( uint64 value_ ) : value( value_ ) {} tomwalters@509: uint64 value; tomwalters@509: tomwalters@509: operator uint64() const { return value; } tomwalters@509: }; tomwalters@509: tomwalters@509: tomwalters@509: struct Symbol{ tomwalters@509: Symbol() {} tomwalters@509: explicit Symbol( const char* value_ ) : value( value_ ) {} tomwalters@509: const char* value; tomwalters@509: tomwalters@509: operator const char *() const { return value; } tomwalters@509: }; tomwalters@509: tomwalters@509: tomwalters@509: struct Blob{ tomwalters@509: Blob() {} tomwalters@509: explicit Blob( const void* data_, unsigned long size_ ) tomwalters@509: : data( data_ ), size( size_ ) {} tomwalters@509: const void* data; tomwalters@509: unsigned long size; tomwalters@509: }; tomwalters@509: tomwalters@509: } // namespace osc tomwalters@509: tomwalters@509: tomwalters@509: #endif /* INCLUDED_OSCTYPES_H */