Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _JAUS_CORE_TYPES_H
00041 #define _JAUS_CORE_TYPES_H
00042
00043 #include <limits.h>
00044 #include <cxutils/packet.h>
00045 #include <cxutils/mutex.h>
00046 #include <cxutils/thread.h>
00047 #include <exception>
00048 #include "jauscoredll.h"
00049
00050 #ifndef NULL
00051 #define NULL 0
00052 #endif
00053
00060 namespace JAUS
00061 {
00062 typedef CxUtils::Packet Packet;
00063 typedef CxUtils::Mutex Mutex;
00064 typedef CxUtils::Thread Thread;
00065
00072 class Exception : public std::exception
00073 {
00074 public:
00075 Exception(const std::string& whatString = "NULL Ptr Access") : mWhatString(whatString) {}
00076 ~Exception() throw () {}
00077 virtual const char* what() const throw();
00078 virtual void Print() const;
00079 std::string mWhatString;
00080 };
00081
00082 typedef unsigned char Byte;
00083 typedef short Short;
00084 typedef int Int;
00085 typedef long long int Long;
00086 typedef unsigned short UShort;
00087 typedef unsigned int UInt;
00088 typedef unsigned long long int ULong;
00089 typedef float Float;
00090 typedef double LongFloat;
00091
00092 const int OK = 1;
00093 const int FAILURE = 0;
00094
00095 const Byte BYTE = 0;
00096 const Byte SHORT = 1;
00097 const Byte INT = 2;
00098 const Byte LONG = 3;
00099 const Byte USHORT = 4;
00100 const Byte UINT = 5;
00101 const Byte ULONG = 6;
00102 const Byte FLOAT = 7;
00103 const Byte LONG_FLOAT = 8;
00104 const Byte RGB = 9;
00105
00106 const Short JAUS_SHORT_MAX = SHRT_MAX;
00107 const Short JAUS_SHORT_MIN = SHRT_MIN;
00108 const UShort JAUS_USHORT_MAX = USHRT_MAX;
00109 const UShort JAUS_USHORT_MIN = 0;
00110 const Int JAUS_INT_MIN = INT_MIN;
00111 const Int JAUS_INT_MAX = INT_MAX;
00112 const UInt JAUS_UINT_MIN = 0;
00113 const UInt JAUS_UINT_MAX = UINT_MAX;
00114 const Long JAUS_LONG_MIN
00115 #ifdef _WIN32_WCE
00116 = _I64_MIN;
00117 #else
00118 #ifdef __GNUC__
00119 #if __GNUC__ > 3
00120 = LLONG_MIN;
00121 #else
00122 = LONG_LONG_MIN;
00123 #endif
00124 #else
00125 = LLONG_MIN;
00126 #endif
00127 #endif
00128 const Long JAUS_LONG_MAX
00129 #ifdef _WIN32_WCE
00130 = _I64_MAX;
00131 #else
00132 #ifdef __GNUC__
00133 #if __GNUC__ > 3
00134 = LLONG_MAX;
00135 #else
00136 = LONG_LONG_MAX;
00137 #endif
00138 #else
00139 = LLONG_MAX;
00140 #endif
00141 #endif
00142 const ULong JAUS_ULONG_MIN = 0;
00143 const ULong JAUS_ULONG_MAX
00144 #ifdef _WIN32_WCE
00145 = _UI64_MAX;
00146 #else
00147 #ifdef __GNUC__
00148 #if __GNUC__ > 3
00149 = ULLONG_MAX;
00150 #else
00151 = ULONG_LONG_MAX;
00152 #endif
00153 #else
00154 = ULLONG_MAX;
00155 #endif
00156 #endif
00157
00158 const UInt BYTE_SIZE = 1;
00159 const UInt SHORT_SIZE = 2;
00160 const UInt USHORT_SIZE = 2;
00161 const UInt INT_SIZE = 4;
00162 const UInt UINT_SIZE = 4;
00163 const UInt FLOAT_SIZE = 4;
00164 const UInt LONG_SIZE = 8;
00165 const UInt ULONG_SIZE = 8;
00166 const UInt LONG_FLOAT_SIZE = 8;
00167
00168 const UInt BYTE_BITS = 8;
00169 const UInt SHORT_BITS = 16;
00170 const UInt USHORT_BITS = 16;
00171 const UInt INT_BITS = 32;
00172 const UInt UINT_BITS = 32;
00173 const UInt FLOAT_BITS = 32;
00174 const UInt LONG_BITS = 64;
00175 const UInt ULONG_BITS = 64;
00176 const UInt LONG_FLOAT_BITS = 64;
00177
00187 class JAUS_CORE_DLL VarType
00188 {
00189 public:
00190 VarType();
00191 VarType(const Byte v);
00192 VarType(const Short v);
00193 VarType(const Int v);
00194 VarType(const Long v);
00195 VarType(const UShort v);
00196 VarType(const UInt v);
00197 VarType(const ULong v);
00198 VarType(const Float v);
00199 VarType(const LongFloat v);
00200 VarType(const Byte r, const Byte g, const Byte b);
00201 VarType(const VarType& vt);
00202 virtual ~VarType();
00203
00204 Byte Type() const;
00205
00206 Byte Size() const;
00207
00208 Byte ToByte() const;
00209
00210 Short ToShort() const;
00211
00212 Int ToInt() const;
00213
00214 Long ToLong() const;
00215
00216 UShort ToUShort() const;
00217
00218 UInt ToUInt() const;
00219
00220 ULong ToULong() const;
00221
00222 Float ToFloat() const;
00223
00224 LongFloat ToLongFloat() const;
00225
00226 Byte* ToRGB() const;
00227
00228 void Print() const;
00229
00230 std::string ToString() const;
00231
00232 bool Equals(const VarType& vt, const double ferror = .000001) const;
00233
00234 static int RunTestCase();
00235
00236 bool operator==(const VarType& vt) const;
00237
00238 bool operator==(const Byte v) const;
00239
00240 bool operator==(const Short v) const;
00241
00242 bool operator==(const Int v) const;
00243
00244 bool operator==(const Long v) const;
00245
00246 bool operator==(const UShort v) const;
00247
00248 bool operator==(const UInt v) const;
00249
00250 bool operator==(const ULong v) const;
00251
00252 bool operator==(const Float v) const;
00253
00254 bool operator==(const LongFloat v) const;
00255
00256 bool operator!=(const VarType& vt) const;
00257
00258 bool operator!=(const Byte v) const;
00259
00260 bool operator!=(const Short v) const;
00261
00262 bool operator!=(const Int v) const;
00263
00264 bool operator!=(const Long v) const;
00265
00266 bool operator!=(const UShort v) const;
00267
00268 bool operator!=(const UInt v) const;
00269
00270 bool operator!=(const ULong v) const;
00271
00272 bool operator!=(const Float v) const;
00273
00274 bool operator!=(const LongFloat v) const;
00275
00276 VarType& operator=(const Byte v);
00277
00278 VarType& operator=(const Short v);
00279
00280 VarType& operator=(const Int v);
00281
00282 VarType& operator=(const Long v);
00283
00284 VarType& operator=(const UShort v);
00285
00286 VarType& operator=(const UInt v);
00287
00288 VarType& operator=(const ULong v);
00289
00290 VarType& operator=(const Float v);
00291
00292 VarType& operator=(const LongFloat v);
00293
00294 VarType& operator=(const VarType& vt);
00295
00296 VarType& operator()(const Byte r, const Byte g, const Byte b);
00297 private:
00298 void* mpData;
00299 Byte mType;
00300 unsigned int mLength;
00301 };
00302
00309 class JAUS_CORE_DLL Limits
00310 {
00311 public:
00312 Limits() {}
00313 virtual ~Limits() {}
00314 };
00315
00323 class JAUS_CORE_DLL PresenceVector
00324 {
00325 public:
00326 PresenceVector() {}
00327 virtual ~PresenceVector() {}
00328 };
00329 }
00330
00331 #endif
00332