SourceTable.h

00001 00002 /* 00003 * ALMA - Atacama Large Millimeter Array 00004 * (c) European Southern Observatory, 2002 00005 * (c) Associated Universities Inc., 2002 00006 * Copyright by ESO (in the framework of the ALMA collaboration), 00007 * Copyright by AUI (in the framework of the ALMA collaboration), 00008 * All rights reserved. 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY, without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00023 * MA 02111-1307 USA 00024 * 00025 * Warning! 00026 * -------------------------------------------------------------------- 00027 * | This is generated code! Do not modify this file. | 00028 * | If you do, all changes will be lost when the file is re-generated. | 00029 * -------------------------------------------------------------------- 00030 * 00031 * File SourceTable.h 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 #include <Enumerations.h> 00071 using namespace enumerations; 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 //class asdm::ASDM; 00146 //class asdm::SourceRow; 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 // ====> Row creation. 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 // ====> Append a row to its table. 00401 // 00402 00403 00404 00405 00406 00416 SourceRow* add(SourceRow* x) ; 00417 00418 00419 00420 // 00421 // ====> Methods returning rows. 00422 // 00423 00429 vector<SourceRow *> get() ; 00430 00431 00432 00433 00434 00448 SourceRow* getRowByKey(int sourceId, Tag spectralWindowId, ArrayTimeInterval timeInterval); 00449 00450 00451 00459 vector <SourceRow *> getRowBySourceId(int); 00460 00461 00462 00484 SourceRow* lookup(Tag spectralWindowId, ArrayTimeInterval timeInterval, int numLines, string sourceName, string code, vector<Angle > direction, vector<AngularRate > properMotion); 00485 00486 00487 #ifndef WITHOUT_ACS 00488 // Conversion Methods 00494 SourceTableIDL *toIDL() ; 00495 #endif 00496 00497 #ifndef WITHOUT_ACS 00498 00504 void fromIDL(SourceTableIDL x) throw(DuplicateKey,ConversionException); 00505 #endif 00506 00510 char *toFITS() const throw(ConversionException); 00511 00515 void fromFITS(char *fits) throw(ConversionException); 00516 00520 string toVOTable() const throw(ConversionException); 00521 00525 void fromVOTable(string vo) throw(ConversionException); 00526 00533 string toXML() throw(ConversionException); 00534 00540 void fromXML(string xmlDoc) throw(ConversionException); 00541 00547 string toMIME(); 00548 00555 void setFromMIME(const string & mimeMsg); 00556 00566 void toFile(string directory); 00567 00576 void setFromFile(const string& directory); 00577 00578 private: 00579 00588 SourceTable (ASDM & container); 00589 00590 ASDM & container; 00591 00592 bool archiveAsBin; // If true archive binary else archive XML 00593 bool fileAsBin ; // If true file binary else file XML 00594 00595 Entity entity; 00596 00597 00598 00602 static string tableName; 00603 00604 00608 static vector<string> key; 00609 00610 00616 SourceRow* checkAndAdd(SourceRow* x) throw (DuplicateKey, UniquenessViolationException); 00617 00618 00619 00620 00628 SourceRow * insertByStartTime(SourceRow* x, vector<SourceRow* >& row); 00629 00630 00631 00632 // A data structure to store the pointers on the table's rows. 00633 00634 // In all cases we maintain a private ArrayList of SourceRow s. 00635 vector<SourceRow * > privateRows; 00636 00637 00638 00639 00640 00641 00642 00643 00644 typedef vector <vector <SourceRow* > > ID_TIME_ROWS; 00645 map<string, ID_TIME_ROWS > context; 00646 00651 string Key(Tag spectralWindowId) ; 00652 00653 00654 00655 00661 void getByKeyNoAutoIncNoTime(vector <SourceRow*>& vin, vector <SourceRow*>& vout, Tag spectralWindowId); 00662 00663 00664 00665 void error() throw(ConversionException); 00666 00667 }; 00668 00669 } // End namespace asdm 00670 00671 #endif /* SourceTable_CLASS */

Generated on Tue Nov 18 17:43:41 2008 for ASDM C++ Implementation by doxygen 1.3.8