Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
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 #ifndef StateTable_CLASS
00035 #define StateTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 #include <set>
00041 using std::string;
00042 using std::vector;
00043 using std::map;
00044
00045
00046
00047 #include <Tag.h>
00048 using asdm::Tag;
00049
00050
00051
00052
00053
00054
00055
00056 #include "CCalibrationDevice.h"
00057 using namespace CalibrationDeviceMod;
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #include <ConversionException.h>
00071 #include <DuplicateKey.h>
00072 #include <UniquenessViolationException.h>
00073 #include <NoSuchRow.h>
00074 #include <DuplicateKey.h>
00075 using asdm::DuplicateKey;
00076 using asdm::ConversionException;
00077 using asdm::NoSuchRow;
00078 using asdm::DuplicateKey;
00079
00080 #ifndef WITHOUT_ACS
00081 #include <asdmIDLC.h>
00082 using asdmIDL::StateTableIDL;
00083 #endif
00084
00085 #include <Representable.h>
00086
00087 namespace asdm {
00088
00089
00090
00091
00092 class ASDM;
00093 class StateRow;
00165 class StateTable : public Representable {
00166 friend class ASDM;
00167
00168 public:
00169
00170
00176 static vector<string> getKeyName();
00177
00178
00179 virtual ~StateTable();
00180
00186 ASDM &getContainer() const;
00187
00193 unsigned int size() ;
00194
00200 string getName() const;
00201
00207 static const vector<string>& getAttributesNames();
00208
00212 Entity getEntity() const;
00213
00218 void setEntity(Entity e);
00219
00227 string toXML() ;
00228
00229 #ifndef WITHOUT_ACS
00230
00236 StateTableIDL *toIDL() ;
00237 #endif
00238
00239 #ifndef WITHOUT_ACS
00240
00246 void fromIDL(StateTableIDL x) ;
00247 #endif
00248
00249
00250
00251
00252
00257 StateRow *newRow();
00258
00259
00273 StateRow *newRow(CalibrationDeviceMod::CalibrationDevice calDeviceName, bool sig, bool ref, bool onSky);
00274
00275
00276
00289 StateRow *newRow(StateRow *row);
00290
00291
00292
00293
00294
00295
00296
00297
00307 StateRow* add(StateRow* x) ;
00308
00309
00310
00311
00312
00313
00314
00320 vector<StateRow *> get() ;
00321
00322
00323
00324
00325
00335 StateRow* getRowByKey(Tag stateId);
00336
00337
00338
00339
00340
00356 StateRow* lookup(CalibrationDeviceMod::CalibrationDevice calDeviceName, bool sig, bool ref, bool onSky);
00357
00358
00359 private:
00360
00369 StateTable (ASDM & container);
00370
00371 ASDM & container;
00372
00373 bool archiveAsBin;
00374 bool fileAsBin ;
00375
00376 Entity entity;
00377
00378
00379
00380 map<string,int> noAutoIncIds;
00381 void autoIncrement(string key, StateRow* x);
00382
00383
00387 static string tableName;
00388
00392 static const vector<string> attributesNames;
00393
00397 static vector<string> initAttributesNames();
00398
00399
00403 static vector<string> key;
00404
00405
00415 StateRow* checkAndAdd(StateRow* x) ;
00416
00417
00418
00419
00420
00421
00422 vector<StateRow * > privateRows;
00423
00424
00425
00426 vector<StateRow *> row;
00427
00428
00429 void error() ;
00430
00431
00438 void fromXML(string xmlDoc) ;
00439
00444 void setFromMIMEFile(const string& directory);
00445 void setFromXMLFile(const string& directory);
00446
00454 string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00455
00456
00463 void setFromMIME(const string & mimeMsg);
00464
00468 string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00469
00479 void toFile(string directory);
00480
00489 void setFromFile(const string& directory);
00490
00491 };
00492
00493 }
00494
00495 #endif