00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef BASEREGMASBASEREGMAS_H
00021 #define BASEREGMASBASEREGMAS_H
00022
00023 #include <iostream>
00024 #include <string>
00025 #include <sstream>
00026 #include <vector>
00027
00028
00029
00030 class ThreadManager;
00031
00032 using namespace std;
00033
00034 enum {
00035
00036
00037 PLOTS_ALL = 0,
00038 PLOTS_OWNED = 1,
00039 PLOTS_RENTED = 2,
00040
00041 STAGE_INIT = 0,
00042 STAGE_NORMAL = 1,
00043
00044 MSG_NO_MSG = 0,
00045 MSG_DEBUG = 1,
00046 MSG_INFO = 2,
00047 MSG_WARNING = 3,
00048 MSG_ERROR = 4,
00049 MSG_CRITICAL_ERROR = 5,
00050
00051 RESSOURCE_ZERO =0,
00052 RESSOURCE_FIXED =1,
00053 RESSOURCE_CALCULATED =2,
00054 RESSOURCE_OBJECTS =3,
00055 RESSOURCE_PIXEL =4,
00056
00057 RESTYPE_GENERIC =0,
00058 RESTYPE_FINANCIAL =1,
00059 RESTYPE_POLICYPREMIUM =2,
00060 RESTYPE_LABOUR =3,
00061 RESTYPE_STABLES =4,
00062 RESTYPE_MACHINARY =5,
00063 RESTYPE_FEED =6,
00064
00065 TYPE_INT =0,
00066 TYPE_DOUBLE =1,
00067 TYPE_STRING =2,
00068 TYPE_BOOL =3,
00069
00070 DATA_INDIVIDUAL =0,
00071 DATA_VECTOR =1,
00072 DATA_NOW =-1,
00073
00074 OUTVL_NONE =0,
00075 OUTVL_MAPS =3,
00076 OUTVL_AGGREGATED =3,
00077 OUTVL_DETAILED =5,
00078 OUTVL_BINMAPS =6,
00079 OUTVL_ALL =7,
00080
00081 AGEXIT_FALSE =0,
00082 AGEXIT_NOCAPITAL =1,
00083 AGEXIT_DEBS =2,
00084 AGEXIT_SHPRICES =3
00085
00086 };
00087
00088
00089
00090 #ifndef M_PI
00091 #define M_PI 3.1415926535897932384626433832795
00092 #endif
00093
00094 #ifndef M_LN2
00095 #define M_LN2 0.69314718055994530941723212145818
00096 #endif
00097
00098 #ifndef M_LN10
00099 #define M_LN10 2.3025850929940456840179914546844
00100 #endif
00101
00103
00109 class BaseRegmas{
00110
00111 public:
00112 BaseRegmas();
00113 ~BaseRegmas();
00114
00115 void msgOut(int msgCode_h, string msg_h, bool refreshGUI_h=true) const;
00116 void msgOut(int msgCode_h, int msg_h, bool refreshGUI_h=true) const;
00117 void msgOut(int msgCode_h, double msg_h, bool refreshGUI_h=true) const;
00118
00119 int s2i ( string string_h) const;
00120 double s2d (string string_h) const;
00121 bool s2b (string string_h) const;
00122 string i2s (int int_h) const;
00123 string d2s (double double_h) const;
00124 string b2s (bool bool_h) const;
00125 vector<int> s2i ( vector<string> string_h) const;
00126 vector<double> s2d (vector<string> string_h) const;
00127 vector<bool> s2b (vector<string> string_h) const;
00128 vector<string> i2s (vector<int> int_h) const;
00129 vector<string> d2s (vector<double> double_h) const;
00130 vector<string> b2s (vector<bool> bool_h) const;
00131
00136 int getType(string &type_h);
00137
00138 void refreshGUI() const;
00139
00140
00141 template<typename T> string toString(const T& x);
00142 template<typename T> T stringTo(const std::string& s);
00143
00144 int iVSum (const vector<int> &intVector_h);
00145 double dVSum (const vector<double> &doubleVector_h);
00146
00148 void tokenize(const string& str, vector<string>& tokens, const string& delimiter = " ");
00149
00150 protected:
00151
00156 ThreadManager* MTHREAD;
00157
00158 private:
00159 void msgOut2(int msgCode_h, string msg_h, bool refreshGUI_h) const;
00160
00161 };
00162
00163 #endif