orca-robotics INTRODUCTION Overview Download and Install Documentation REPOSITORY Interfaces Drivers Libraries Utilities Software Map DEVELOPER Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
ndefines.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 NovAtel Inc. 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef __NDEFINES_H 00012 #define __NDEFINES_H 00013 00014 namespace hydronovatelutil{ 00015 00017 // Standard Types 00019 typedef signed int INT; // Signed Machine word size (Assume to be no larger than 16 bit) 00020 typedef unsigned int UINT; // Unsigned Machine word size (Assume to be no larger than 16 bit) 00021 00022 // Defined by microsoft 00023 typedef char CHAR; // Signed 1-byte 00024 typedef unsigned char UCHAR; // Unsigned 1-byte 00025 typedef signed short SHORT; // Signed 2-byte (Unsuported for the T-805) 00026 typedef unsigned short USHORT; // Unsigned 2-byte (Unsuported for the T-805) 00027 typedef signed long LONG; // Signed 4-byte 00028 typedef unsigned long ULONG; // Unsigned 4-byte 00029 00030 typedef float FLOAT; // Single precision - IEEE floating point 32 bits 00031 typedef double DOUBLE; // Double precision - IEEE floating point 64 bits 00032 typedef long double LDOUBLE; // Extended double precision - 80 bits 00033 00034 typedef int BOOL; // BOOL (TRUE or FALSE) 00035 typedef unsigned char BOOLCHAR;// BOOL (TRUE or FALSE) 1-byte 00036 00037 00039 // Other Global Types 00041 typedef DOUBLE GPS_TIME; // Time in seconds 00042 typedef LDOUBLE BTIME; // Big Time in bigger seconds 00043 00045 // BOOLEAN Values 00047 #define TRUE (1) 00048 #define FALSE (0) 00049 #define YES (1) 00050 #define NO (0) 00051 #define ON (1) 00052 #define OFF (0) 00053 #define GOOD (1) 00054 #define BAD (0) 00055 00057 // NULLs 00059 #ifndef NULL 00060 #define NULL (0) // Pointer 00061 #endif 00062 #ifndef NUL 00063 #define NUL (0) // End of String 00064 #endif 00065 00066 #define DBL_EQUAL(x,v) ((fabs((DOUBLE) (x) - (DOUBLE) (v) )) < DBL_EPSILON) 00067 00068 // Make character upper case 00069 #define TOUPPER(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch)-'a'+'A' : (ch)) 00070 00071 // Convert an ASCII hex character to a nibble 00072 #define CHARTOHEX(ch) ((ch) >= 'A' ? ((ch) - 'A')+10 : (ch) - '0') 00073 00074 // 08/12/1999 [CEL] I added a char in front of the definition for HEXTOCHAR as 00075 // it was generating compiler errors in the form of 00076 // significant figures may be lost due to conversion. 00077 // Convert a nibble to a ASCII hex character 00078 #define HEXTOCHAR(hx) char((hx) >= 0x0A ? (hx) + 'A' - 0x0A : (hx) + '0') 00079 00080 // Convert a nibble to a ASCII hex character 00081 #define ISHEX(hx) (((hx) >= '0' && (hx) <= '9') || (TOUPPER(hx) >= 'A' && TOUPPER(hx) <= 'F')) 00082 00083 // Return the smallest of the two values 00084 #define MIN(x,y) ((x)<(y) ? (x) : (y)) 00085 00086 // Return the largest of the two values 00087 #define MAX(x,y) ((x)<(y) ? (y) : (x)) 00088 00089 // Return the square value 00090 #define SQR(x) ((x)*(x)) 00091 00092 // Compare DOUBLES 00093 #define COMPARE_REAL(X, Y, D) ((fabs((X)-(Y)) < (D)) ? 1:0) 00094 00095 // Conversion factors 00096 #define M2INM ((double) (0.00053995680)) /* INM - International nautical mile */ 00097 #define M2FT ((double) (1.0/0.3048)) 00098 #define M2MILE ((double) (0.00062137119)) 00099 #define MBAR2KPA ((double) (1.0/10.0)) 00100 #define MBAR2INI ((double) (1.0/33.8639)) 00101 #define MBAR2MM ((double) (1.0/1.33322)) 00102 #define MBAR2PSI ((double) (1.0/68.94757)) 00103 00104 } 00105 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)