FreqOffsetTable.h
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 FreqOffsetTable_CLASS
00035 #define FreqOffsetTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <Tag.h>
00045
00046
00047
00048 #include <Frequency.h>
00049
00050
00051
00052 #include <ArrayTimeInterval.h>
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 #include <ConversionException.h>
00065 #include <DuplicateKey.h>
00066 #include <UniquenessViolationException.h>
00067 #include <NoSuchRow.h>
00068 #include <DuplicateKey.h>
00069
00070
00071 #ifndef WITHOUT_ACS
00072 #include <asdmIDLC.h>
00073 #endif
00074
00075 #include <Representable.h>
00076
00077 #include <pthread.h>
00078
00079 namespace asdm {
00080
00081
00082
00083
00084 class ASDM;
00085 class FreqOffsetRow;
00153 class FreqOffsetTable : public Representable {
00154 friend class ASDM;
00155
00156 public:
00157
00158
00164 static const std::vector<std::string>& getKeyName();
00165
00166
00167 virtual ~FreqOffsetTable();
00168
00174 ASDM &getContainer() const;
00175
00181 unsigned int size() const;
00182
00190 std::string getName() const;
00191
00199 static std::string name() ;
00200
00205 std::string getVersion() const ;
00206
00212 static const std::vector<std::string>& getAttributesNames();
00213
00219 static const std::vector<std::string>& defaultAttributesNamesInBin();
00220
00224 Entity getEntity() const;
00225
00230 void setEntity(Entity e);
00231
00239 std::string toXML() ;
00240
00241 #ifndef WITHOUT_ACS
00242
00248 asdmIDL::FreqOffsetTableIDL *toIDL() ;
00249
00257 void toIDL(asdmIDL::FreqOffsetTableIDL& x) const;
00258
00259 #endif
00260
00261 #ifndef WITHOUT_ACS
00262
00268 void fromIDL(asdmIDL::FreqOffsetTableIDL x) ;
00269 #endif
00270
00271
00272
00273
00274
00279 FreqOffsetRow *newRow();
00280
00281
00297 FreqOffsetRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset);
00298
00299
00300
00313 FreqOffsetRow *newRow(FreqOffsetRow *row);
00314
00315
00316
00317
00318
00319
00336 FreqOffsetRow* add(FreqOffsetRow* x) ;
00337
00338
00339
00340
00341
00342
00343
00344
00345
00351 std::vector<FreqOffsetRow *> get() ;
00352
00359 const std::vector<FreqOffsetRow *>& get() const ;
00360
00361
00372 std::vector <FreqOffsetRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
00373
00374
00375
00376
00377
00393 FreqOffsetRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
00394
00395
00396
00397
00398
00416 FreqOffsetRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset);
00417
00418
00419 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00420 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00421
00422 private:
00423
00432 FreqOffsetTable (ASDM & container);
00433
00434 ASDM & container;
00435
00436 bool archiveAsBin;
00437 bool fileAsBin ;
00438
00439 std::string version ;
00440
00441 Entity entity;
00442
00443
00444
00452 FreqOffsetRow* checkAndAdd(FreqOffsetRow* x, bool skipCheckUniqueness=false) ;
00453
00459 void append(FreqOffsetRow* x) ;
00460
00466 void addWithoutCheckingUnique(FreqOffsetRow* x) ;
00467
00468
00469
00470
00471
00472
00480 FreqOffsetRow * insertByStartTime(FreqOffsetRow* x, std::vector<FreqOffsetRow* >& row);
00481
00482
00483
00484
00485
00486
00487 std::vector<FreqOffsetRow * > privateRows;
00488
00489
00490
00491
00492
00493
00494
00495
00496 typedef std::vector <FreqOffsetRow* > TIME_ROWS;
00497 std::map<std::string, TIME_ROWS > context;
00498
00503 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
00504
00505
00506
00507
00513 void getByKeyNoAutoIncNoTime(std::vector <FreqOffsetRow*>& vin, std::vector <FreqOffsetRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId);
00514
00515
00516
00517 void error() ;
00518
00519
00526 void fromXML(std::string& xmlDoc) ;
00527
00528 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00529
00534 void setFromMIMEFile(const std::string& directory);
00535
00536
00537
00538 void setFromXMLFile(const std::string& directory);
00539
00547 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00548
00549
00556 void setFromMIME(const std::string & mimeMsg);
00557
00561 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00562
00572 void toFile(std::string directory);
00573
00577 bool loadInProgress;
00578 void checkPresenceInMemory() {
00579 if (!presentInMemory && !loadInProgress) {
00580 loadInProgress = true;
00581 setFromFile(getContainer().getDirectory());
00582 presentInMemory = true;
00583 loadInProgress = false;
00584 }
00585 }
00594 void setFromFile(const std::string& directory);
00595
00596 };
00597
00598 }
00599
00600 #endif