00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GENLIB2_UANGLE_INCLUDED
00022 #define GENLIB2_UANGLE_INCLUDED
00023
00024 #include <ostream>
00025 #include "mpc.h"
00026 using namespace std;
00027
00028 namespace GenLib2
00029 {
00030
00038 class UnitAngle
00039 {
00040 public:
00042 enum ecode
00043 {
00045 UNKNOWN,
00046
00048 NONE,
00049
00051 RADIAN,
00052
00054 DEGREE,
00055
00057 HOUR,
00058
00060 MINUTE,
00061
00063 SECOND,
00064
00066 GON
00067 };
00068
00074 bool set(const char* symbol);
00075
00077 UnitAngle() { set("rad"); }
00078
00083 UnitAngle(const char* symbol) { set(symbol); }
00084
00086 virtual ~UnitAngle() { }
00087
00092 double rho() const { return _rho; }
00093
00098 const char* symbol() const { return _map[_code].symbol; }
00099
00105 static ecode code(const char* symbol);
00106
00112 static const char* name(int code);
00113
00119 static const char* symbol(int code);
00120
00129 static double rho(int code);
00130
00131
00132
00133
00134
00135
00136
00138 void print(ostream& os) const;
00139
00140 protected:
00142 ecode _code;
00143
00145 double _rho;
00146
00148 static const int _map_size;
00149
00151 struct map_t
00152 {
00154 int code;
00155
00157 const char* symbol;
00158
00160 const char* name;
00161
00163 double rho;
00164 };
00165
00167 static map_t _map[];
00168 };
00169
00170
00171
00172
00173 }
00174
00175 #endif