00001 /* 00002 * WOscLib, an object oriented OSC library. 00003 * Copyright (C) 2005 Uli Clemens Franke, Weiss Engineering LTD, Switzerland. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * For details see lgpl.txt 00020 * 00021 * Weiss Engineering LTD. 00022 * Florastrass 42 00023 * 8610 Uster 00024 * Switzerland 00025 * 00026 * uli.franke@weiss.ch 00027 */ 00028 00029 /** WOscBlob header file. 00030 * \file 00031 * 00032 * $Author: cls-nebadje $ ( \ref _UcfWOscLib ) 00033 * $Date: 2006-08-10 10:55:11 $ 00034 * $Revision: 1.3 $ 00035 * 00036 * Copyright (c) Weiss Engineering Ltd 00037 * 00038 */ 00039 #ifndef __WOSCBLOB_H__ 00040 #define __WOSCBLOB_H__ 00041 00042 #include "WOscLib.h" 00043 00044 /** Encapsulates an OSC-blob for transmission of binary data. 00045 * Used to transport proprietary data over the OSC-protocol. 00046 * Inherit your own class from this object, for instance 00047 * a firmware-packet class, which could transport binary 00048 * data fo firmware updates. 00049 * 00050 * \remarks 00051 * When using datagram transmission, make sure that the 00052 * receive-buffer of the other peer can handle your 00053 * OSC-packet size (most systems can handle UDP datagram-packets 00054 * of sizes up to 512bytes) 00055 * 00056 * 00057 * \todo 00058 * Change GetBufferLen to getDataLenZeroPadded 00059 * 00060 */ 00061 class WOSC_EXPORT WOscBlob{ 00062 public: 00063 WOscBlob(const char* binaryData); 00064 WOscBlob(const char* binaryData, int dataLen); 00065 WOscBlob(WOscBlob* b); 00066 WOscBlob(WOscBlob& b); 00067 virtual ~WOscBlob(); 00068 00069 WOscBlob& operator= (WOscBlob &rhs); 00070 00071 int GetDataLen() const; 00072 const char* GetData() const; 00073 00074 int GetBufferLen() const; 00075 void GetBuffer(char* buffer, int bufferLen) const; 00076 const char* GetBuffer() const; 00077 00078 enum Constants{ 00079 BLOB_SIZE_SIZE = 4, /**< Size of blob's size. */ 00080 }; 00081 00082 private: 00083 WOscBlob(); // disable default constructor 00084 00085 int m_dataLen; /**< Length of data without zero padding.*/ 00086 char* m_buffer; /**< Data zero padded.*/ 00087 int m_bufferLen; /**< m_dataLen Rounded up to next multiple of 4.*/ 00088 00089 }; 00090 00091 #endif // #ifndef __WOSCBLOB_H__