00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00034 #ifndef OSCPACKER_H
00035 #define OSCPACKER_H
00036
00037 #include "int64_t.h"
00038
00039 #ifdef __MACH__
00040 #include <sys/types.h>
00041 #include <machine/endian.h>
00042 #else
00043 #include <netinet/in.h>
00044 #endif
00045
00046
00047 #include <string>
00048
00049
00050 class OSCPacker
00051 {
00052 private:
00053 std::string myData;
00054
00055 protected:
00056 std::string *getDataPointer() { return &(this->myData); }
00057 bool appendFourBytes (char *bytes);
00058 bool appendEightBytes (char *bytes);
00059 bool appendBytes (char *bytes, int count);
00061 void padString(std::string *data);
00062 virtual bool packBytes (const char*, int bytes);
00063
00064 public:
00065 OSCPacker() {}
00066 virtual ~OSCPacker() {}
00067
00068 virtual void init() {}
00069 virtual void reset();
00070
00071 virtual bool packInt (int32_t);
00072 virtual bool packHyper (int64_t);
00073 virtual bool packFloat (float);
00074 virtual bool packDouble (double);
00075 virtual bool packString (const std::string*);
00076 virtual bool packString (const char*);
00077 virtual bool packBlob (const char*, int bytes);
00078
00079 virtual std::string getData();
00080 };
00081
00082 #endif