00001 #pragma ident "$Id: Variable.hpp 2595 2011-05-14 17:22:04Z yanweignss $"
00002
00008 #ifndef GPSTK_VARIABLE_HPP
00009 #define GPSTK_VARIABLE_HPP
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "DataStructures.hpp"
00036 #include "StochasticModel.hpp"
00037
00038
00039
00040 namespace gpstk
00041 {
00042
00045
00046
00048 class Variable
00049 {
00050 public:
00051
00053 Variable();
00054
00055
00071 Variable( const TypeID& type,
00072 StochasticModel* pModel = &Variable::defaultModel,
00073 bool sourceIndexed = true,
00074 bool satIndexed = false,
00075 double variance = 4.0e14,
00076 double coef = 1.0,
00077 bool forceCoef = false );
00078
00079
00081 TypeID getType() const
00082 { return varType; };
00083
00084
00089 Variable& setType(const TypeID& type)
00090 { varType = type; return (*this); };
00091
00092
00094 StochasticModel* getModel() const
00095 { return pVarModel; };
00096
00097
00104 Variable& setModel(StochasticModel* pModel)
00105 { pVarModel = pModel; return (*this); };
00106
00107
00109 bool getSourceIndexed() const
00110 { return isSourceIndexed; };
00111
00112
00118 Variable& setSourceIndexed(bool sourceIndexed)
00119 { isSourceIndexed = sourceIndexed; return (*this); };
00120
00121
00123 bool getSatIndexed() const
00124 { return isSatIndexed; };
00125
00126
00132 Variable& setSatIndexed(bool satIndexed)
00133 { isSatIndexed = satIndexed; return (*this); };
00134
00135
00137 bool getTypeIndexed() const
00138 { return isTypeIndexed; };
00139
00140
00146 Variable& setTypeIndexed(bool typeIndexed)
00147 { isTypeIndexed = typeIndexed; return (*this); };
00148
00149
00151 double getInitialVariance() const
00152 { return initialVariance; };
00153
00154
00159 Variable& setInitialVariance(double variance)
00160 { initialVariance = variance; return (*this); };
00161
00162
00164 double getDefaultCoefficient() const
00165 { return defaultCoefficient; };
00166
00167
00172 Variable& setDefaultCoefficient(double coef)
00173 { defaultCoefficient = coef; return (*this); };
00174
00175
00177 bool isDefaultForced() const
00178 { return forceDefault; };
00179
00180
00185 Variable& setDefaultForced(bool forceCoef)
00186 { forceDefault = forceCoef; return (*this); };
00187
00188
00190 SourceID getSource() const
00191 { return varSource; };
00192
00193
00198 Variable& setSource(const SourceID& source)
00199 { varSource = source; return (*this); };
00200
00201
00202
00204 SatID getSatellite() const
00205 { return varSat; };
00206
00207
00212 Variable& setSatellite(const SatID& satellite)
00213 { varSat = satellite; return (*this); };
00214
00215
00217 virtual bool operator==(const Variable& right) const;
00218
00219
00223 virtual bool operator<(const Variable& right) const;
00224
00225
00227 bool operator!=(const Variable& right) const
00228 { return !(operator==(right)); }
00229
00230
00232 virtual Variable& operator=(const Variable& right);
00233
00234
00237 static SourceID allSources;
00238
00239
00242 static SourceID someSources;
00243
00244
00247 static SatID noSats;
00248
00249
00252 static SatID allSats;
00253
00254
00257 static SatID allGPSSats;
00258
00259
00262 static SatID allGalileoSats;
00263
00264
00267 static SatID allGlonassSats;
00268
00269
00271 static WhiteNoiseModel defaultModel;
00272
00273
00275 virtual ~Variable() {};
00276
00277
00278 private:
00279
00280
00282 TypeID varType;
00283
00284
00286 StochasticModel* pVarModel;
00287
00288
00294 bool isSourceIndexed;
00295
00296
00307 bool isSatIndexed;
00308
00309
00319 bool isTypeIndexed;
00320
00321
00323 double initialVariance;
00324
00325
00327 double defaultCoefficient;
00328
00329
00331 bool forceDefault;
00332
00333
00335 SourceID varSource;
00336
00337
00339 SatID varSat;
00340
00341
00352 void Init( const TypeID& type,
00353 StochasticModel* pModel = &Variable::defaultModel,
00354 double variance = 4.0e14,
00355 double coef = 1.0,
00356 bool forceCoef = false,
00357 bool typeIndex = true);
00358
00359
00360 };
00361
00362
00364
00365 typedef std::set<Variable> VariableSet;
00366
00367 typedef std::list<Variable> VariableList;
00368
00369 typedef std::map<Variable, double> VariableDataMap;
00370
00371
00372 namespace StringUtils
00373 {
00374 inline std::string asString(const Variable& v)
00375 {
00376 std::ostringstream oss;
00377 oss << v.getType() << " "
00378 << v.getSource() << " "
00379 << v.getSatellite() << " "
00380 << v.getTypeIndexed() << " "
00381 << v.getSourceIndexed() << " "
00382 << v.getSatIndexed();
00383
00384 return oss.str();
00385 }
00386 }
00388
00389 }
00390 #endif // GPSTK_VARIABLE_HPP