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 SourceTable_CLASS
00035 #define SourceTable_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
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 #include "CSourceModel.h"
00105 using namespace SourceModelMod;
00106
00107
00108
00109
00110
00111
00112
00113 #ifndef WITHOUT_ACS
00114 #include <asdmIDLC.h>
00115 using asdmIDL::SourceTableIDL;
00116 #endif
00117
00118 using asdm::Angle;
00119 using asdm::AngularRate;
00120 using asdm::ArrayTime;
00121 using asdm::Complex;
00122 using asdm::Entity;
00123 using asdm::EntityId;
00124 using asdm::EntityRef;
00125 using asdm::Flux;
00126 using asdm::Frequency;
00127 using asdm::Humidity;
00128 using asdm::Interval;
00129 using asdm::Length;
00130 using asdm::PartId;
00131 using asdm::Pressure;
00132 using asdm::Speed;
00133 using asdm::Tag;
00134 using asdm::Temperature;
00135
00136 using asdm::DuplicateKey;
00137 using asdm::ConversionException;
00138 using asdm::NoSuchRow;
00139 using asdm::DuplicateKey;
00140
00141 #include <Representable.h>
00142
00143 namespace asdm {
00144
00145
00146
00147
00148 class ASDM;
00149 class SourceRow;
00286 class SourceTable : public Representable {
00287 friend class asdm::ASDM;
00288
00289 public:
00290
00291
00297 static vector<string> getKeyName();
00298
00299
00300 virtual ~SourceTable();
00301
00307 ASDM &getContainer() const;
00308
00314 unsigned int size() ;
00315
00321 string getName() const;
00322
00326 Entity getEntity() const;
00327
00332 void setEntity(Entity e);
00333
00334
00335
00336
00337
00342 SourceRow *newRow();
00343
00348 SourceRow* newRowEmpty();
00349
00350
00370 SourceRow *newRow(Tag spectralWindowId, ArrayTimeInterval timeInterval, int numLines, string sourceName, string code, vector<Angle > direction, vector<AngularRate > properMotion);
00371
00376 SourceRow *newRowFull(Tag spectralWindowId, ArrayTimeInterval timeInterval, int numLines, string sourceName, string code, vector<Angle > direction, vector<AngularRate > properMotion);
00377
00378
00391 SourceRow *newRow(SourceRow *row);
00392
00397 SourceRow *newRowCopy(SourceRow *row);
00398
00399
00400
00401
00402
00403
00404
00405
00406
00416 SourceRow* add(SourceRow* x) ;
00417
00418
00419
00420
00421
00422
00423
00429 vector<SourceRow *> get() ;
00430
00431
00439 vector <SourceRow*> *getByContext(Tag spectralWindowId);
00440
00441
00442
00443
00444
00458 SourceRow* SourceTable::getRowByKey(int sourceId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
00459
00460
00461
00469 vector <SourceRow *> SourceTable::getRowBySourceId(int);
00470
00471
00472
00494 SourceRow* lookup(Tag spectralWindowId, ArrayTimeInterval timeInterval, int numLines, string sourceName, string code, vector<Angle > direction, vector<AngularRate > properMotion);
00495
00496
00497 #ifndef WITHOUT_ACS
00498
00504 SourceTableIDL *toIDL() ;
00505 #endif
00506
00507 #ifndef WITHOUT_ACS
00508
00514 void fromIDL(SourceTableIDL x) throw(DuplicateKey,ConversionException);
00515 #endif
00516
00520 char *toFITS() const throw(ConversionException);
00521
00525 void fromFITS(char *fits) throw(ConversionException);
00526
00530 string toVOTable() const throw(ConversionException);
00531
00535 void fromVOTable(string vo) throw(ConversionException);
00536
00543 string toXML() throw(ConversionException);
00544
00550 void fromXML(string xmlDoc) throw(ConversionException);
00551
00557 string toMIME();
00558
00565 void setFromMIME(const string & mimeMsg);
00566
00576 void toFile(string directory);
00577
00586 void setFromFile(const string& directory);
00587
00588 private:
00589
00598 SourceTable (ASDM & container);
00599
00600 ASDM & container;
00601
00602 bool archiveAsBin;
00603 bool fileAsBin ;
00604
00605 Entity entity;
00606
00607
00608
00612 static string tableName;
00613
00614
00618 static vector<string> key;
00619
00620
00626 SourceRow* checkAndAdd(SourceRow* x) throw (DuplicateKey, UniquenessViolationException);
00627
00628
00629
00630
00638 SourceRow * insertByStartTime(SourceRow* x, vector<SourceRow* >& row);
00639
00640
00641
00642
00643
00644
00645 vector<SourceRow * > privateRows;
00646
00647
00648
00649
00650
00651
00652
00653
00654 typedef vector <vector <SourceRow* > > ID_TIME_ROWS;
00655 map<string, ID_TIME_ROWS > context;
00656
00661 string Key(Tag spectralWindowId) ;
00662
00663
00664
00665
00671 void getByKeyNoAutoIncNoTime(vector <SourceRow*>& vin, vector <SourceRow*>& vout, Tag spectralWindowId);
00672
00673
00674
00675 void error() throw(ConversionException);
00676
00677 };
00678
00679 }
00680
00681 #endif