00001 #ifndef TOOLS_H
00002 #define TOOLS_H
00003
00004 #include <string>
00005 #include <sstream>
00006 #include "Constant.h"
00007 #include <math.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 using namespace std;
00032
00033
00034 string itos(int i);
00035 string ltos(long l);
00036 string dtos(double d);
00037
00038 double RadiansToDegres(double dRadians);
00039 double DegresToRadians(double dDegres);
00040
00041 double BrasSinus(double dL,double dAngle);
00042
00043 double InverseBrasSinus(double dL,double dTranslation);
00044
00045
00046 double BrasTangente(double dL,double dAngle);
00047 double InverseBrasTangente(double dL,double dTranslation);
00048
00049
00050 std::string GetDeviceState(int iDeviceState);
00051
00053 template <class ObjectType>
00054 void DESTRUCTION(ObjectType*& objectName)
00055 {
00056 if(objectName)
00057 {
00058 delete objectName;
00059 objectName = 0;
00060 }
00061 }
00062
00064 template <class ObjectType>
00065 ObjectType Maximum(ObjectType& obj1,ObjectType& obj2)
00066 {
00067 return obj1 <= obj2 ? obj2 : obj1;
00068 }
00069
00071 template <class ObjectType>
00072 ObjectType Minimum(ObjectType& obj1,ObjectType& obj2)
00073 {
00074 return obj1 <= obj2 ? obj1 : obj2;
00075 }
00076
00077
00079 template <class ObjectType>
00080 bool isGreaterThan(ObjectType& obj1,ObjectType& obj2)
00081 {
00082 return obj1 >= obj2;
00083 }
00084
00086 template <class ObjectType>
00087 bool isStrictlyGreaterThan(ObjectType& obj1,ObjectType& obj2)
00088 {
00089 return obj1 > obj2;
00090 }
00091
00093 template <class ObjectType>
00094 bool isLessThan(ObjectType& obj1,ObjectType& obj2)
00095 {
00096 return obj1 <= obj2;
00097 }
00098
00100 template <class ObjectType>
00101 bool isStrictlyLessThan(ObjectType& obj1,ObjectType& obj2)
00102 {
00103 return obj1 < obj2;
00104 }
00105
00107 template <class ObjectType>
00108 bool areEquals(ObjectType& obj1,ObjectType& obj2)
00109 {
00110 return obj1 == obj2;
00111 }
00112
00113
00114
00115
00116
00117 #endif
00118