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 #include <Angle.h>
00046 #include <AngularRate.h>
00047 #include <ArrayTime.h>
00048 #include <ArrayTimeInterval.h>
00049 #include <Complex.h>
00050 #include <Entity.h>
00051 #include <EntityId.h>
00052 #include <EntityRef.h>
00053 #include <Flux.h>
00054 #include <Frequency.h>
00055 #include <Humidity.h>
00056 #include <Interval.h>
00057 #include <Length.h>
00058 #include <PartId.h>
00059 #include <Pressure.h>
00060 #include <Speed.h>
00061 #include <Tag.h>
00062 #include <Temperature.h>
00063 #include <ConversionException.h>
00064 #include <DuplicateKey.h>
00065 #include <UniquenessViolationException.h>
00066 #include <NoSuchRow.h>
00067 #include <DuplicateKey.h>
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 #include "CCalibrationDevice.h"
00089 using namespace CalibrationDeviceMod;
00090
00091
00092
00093
00094
00095 #ifndef WITHOUT_ACS
00096 #include <asdmIDLC.h>
00097 using asdmIDL::StateTableIDL;
00098 #endif
00099
00100 using asdm::Angle;
00101 using asdm::AngularRate;
00102 using asdm::ArrayTime;
00103 using asdm::Complex;
00104 using asdm::Entity;
00105 using asdm::EntityId;
00106 using asdm::EntityRef;
00107 using asdm::Flux;
00108 using asdm::Frequency;
00109 using asdm::Humidity;
00110 using asdm::Interval;
00111 using asdm::Length;
00112 using asdm::PartId;
00113 using asdm::Pressure;
00114 using asdm::Speed;
00115 using asdm::Tag;
00116 using asdm::Temperature;
00117
00118 using asdm::DuplicateKey;
00119 using asdm::ConversionException;
00120 using asdm::NoSuchRow;
00121 using asdm::DuplicateKey;
00122
00123 #include <Representable.h>
00124
00125 namespace asdm {
00126
00127
00128
00129
00130 class ASDM;
00131 class StateRow;
00198 class StateTable : public Representable {
00199 friend class asdm::ASDM;
00200
00201 public:
00202
00203
00209 static vector<string> getKeyName();
00210
00211
00212 virtual ~StateTable();
00213
00219 ASDM &getContainer() const;
00220
00226 unsigned int size() ;
00227
00233 string getName() const;
00234
00238 Entity getEntity() const;
00239
00244 void setEntity(Entity e);
00245
00246
00247
00248
00249
00254 StateRow *newRow();
00255
00260 StateRow* newRowEmpty();
00261
00262
00278 StateRow *newRow(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow);
00279
00284 StateRow *newRowFull(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow);
00285
00286
00299 StateRow *newRow(StateRow *row);
00300
00305 StateRow *newRowCopy(StateRow *row);
00306
00307
00308
00309
00310
00311
00312
00313
00323 StateRow* add(StateRow* x) ;
00324
00325
00326
00327
00328
00329
00330
00336 vector<StateRow *> get() ;
00337
00338
00339
00340
00341
00351 StateRow* StateTable::getRowByKey(Tag stateId);
00352
00353
00354
00355
00356
00374 StateRow* lookup(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow);
00375
00376
00377 #ifndef WITHOUT_ACS
00378
00384 StateTableIDL *toIDL() ;
00385 #endif
00386
00387 #ifndef WITHOUT_ACS
00388
00394 void fromIDL(StateTableIDL x) throw(DuplicateKey,ConversionException);
00395 #endif
00396
00400 char *toFITS() const throw(ConversionException);
00401
00405 void fromFITS(char *fits) throw(ConversionException);
00406
00410 string toVOTable() const throw(ConversionException);
00411
00415 void fromVOTable(string vo) throw(ConversionException);
00416
00423 string toXML() throw(ConversionException);
00424
00430 void fromXML(string xmlDoc) throw(ConversionException);
00431
00437 string toMIME();
00438
00445 void setFromMIME(const string & mimeMsg);
00446
00456 void toFile(string directory);
00457
00466 void setFromFile(const string& directory);
00467
00468 private:
00469
00478 StateTable (ASDM & container);
00479
00480 ASDM & container;
00481
00482 bool archiveAsBin;
00483 bool fileAsBin ;
00484
00485 Entity entity;
00486
00487
00488
00489 map<string,int> noAutoIncIds;
00490 void autoIncrement(string key, StateRow* x);
00491
00492
00496 static string tableName;
00497
00498
00502 static vector<string> key;
00503
00504
00510 StateRow* checkAndAdd(StateRow* x) throw (DuplicateKey, UniquenessViolationException);
00511
00512
00513
00514
00515
00516
00517 vector<StateRow * > privateRows;
00518
00519
00520
00521 vector<StateRow *> row;
00522
00523
00524 void error() throw(ConversionException);
00525
00526 };
00527
00528 }
00529
00530 #endif