Tools.h

Go to the documentation of this file.
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 //#include "TrigonometricValueOutOfBoundException.h"
00010 //#include "DivideByZeroException.h"
00011 
00012 
00013 /*enum TANGO_STATES
00014 {
00015         ON,             //0
00016         OFF,    //
00017         CLOSE,
00018         OPEN,
00019         INSERT,
00020         EXTRACT,
00021         MOVING,
00022         STANDBY,
00023         FAULT,
00024         INIT,
00025         RUNNING,
00026         ALARM,
00027         DISABLE,
00028         UNKNOW
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 //double  InverseBrasSinus(double dL,double dTranslation); //throw (DivideByZeroException,TrigonometricValueOutOfBoundException);
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 

Generated on Fri Jul 10 10:31:56 2009 for Utils Library by  doxygen 1.4.5