ReceiverTable.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 ReceiverTable_CLASS
00035 #define ReceiverTable_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
00065
00066
00067 #include "CReceiverBand.h"
00068
00069
00070
00071
00072
00073 #include "CReceiverSideband.h"
00074
00075
00076
00077 #include "CNetSideband.h"
00078
00079
00080
00081
00082 #include <ConversionException.h>
00083 #include <DuplicateKey.h>
00084 #include <UniquenessViolationException.h>
00085 #include <NoSuchRow.h>
00086 #include <DuplicateKey.h>
00087
00088
00089 #ifndef WITHOUT_ACS
00090 #include <asdmIDLC.h>
00091 #endif
00092
00093 #include <Representable.h>
00094
00095 #include <pthread.h>
00096
00097 namespace asdm {
00098
00099
00100
00101
00102 class ASDM;
00103 class ReceiverRow;
00197 class ReceiverTable : public Representable {
00198 friend class ASDM;
00199
00200 public:
00201
00202
00208 static const std::vector<std::string>& getKeyName();
00209
00210
00211 virtual ~ReceiverTable();
00212
00218 ASDM &getContainer() const;
00219
00225 unsigned int size() const;
00226
00234 std::string getName() const;
00235
00243 static std::string name() ;
00244
00249 std::string getVersion() const ;
00250
00256 static const std::vector<std::string>& getAttributesNames();
00257
00263 static const std::vector<std::string>& defaultAttributesNamesInBin();
00264
00268 Entity getEntity() const;
00269
00274 void setEntity(Entity e);
00275
00283 std::string toXML() ;
00284
00285 #ifndef WITHOUT_ACS
00286
00292 asdmIDL::ReceiverTableIDL *toIDL() ;
00293
00301 void toIDL(asdmIDL::ReceiverTableIDL& x) const;
00302
00303 #endif
00304
00305 #ifndef WITHOUT_ACS
00306
00312 void fromIDL(asdmIDL::ReceiverTableIDL x) ;
00313 #endif
00314
00315
00316
00317
00318
00323 ReceiverRow *newRow();
00324
00325
00347 ReceiverRow *newRow(Tag spectralWindowId, ArrayTimeInterval timeInterval, string name, int numLO, ReceiverBandMod::ReceiverBand frequencyBand, vector<Frequency > freqLO, ReceiverSidebandMod::ReceiverSideband receiverSideband, vector<NetSidebandMod::NetSideband > sidebandLO);
00348
00349
00350
00363 ReceiverRow *newRow(ReceiverRow *row);
00364
00365
00366
00367
00368
00369
00370
00371
00372
00382 ReceiverRow* add(ReceiverRow* x) ;
00383
00384
00385
00386
00387
00388
00389
00395 std::vector<ReceiverRow *> get() ;
00396
00403 const std::vector<ReceiverRow *>& get() const ;
00404
00405
00406
00407
00408
00422 ReceiverRow* getRowByKey(int receiverId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
00423
00424
00425
00433 std::vector <ReceiverRow *> getRowByReceiverId(int);
00434
00435
00436
00460 ReceiverRow* lookup(Tag spectralWindowId, ArrayTimeInterval timeInterval, string name, int numLO, ReceiverBandMod::ReceiverBand frequencyBand, vector<Frequency > freqLO, ReceiverSidebandMod::ReceiverSideband receiverSideband, vector<NetSidebandMod::NetSideband > sidebandLO);
00461
00462
00463 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00464 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00465
00466 private:
00467
00476 ReceiverTable (ASDM & container);
00477
00478 ASDM & container;
00479
00480 bool archiveAsBin;
00481 bool fileAsBin ;
00482
00483 std::string version ;
00484
00485 Entity entity;
00486
00487
00488
00498 ReceiverRow* checkAndAdd(ReceiverRow* x, bool skipCheckUniqueness=false) ;
00499
00505 void append(ReceiverRow* x) ;
00506
00512 void addWithoutCheckingUnique(ReceiverRow* x) ;
00513
00514
00515
00516
00517
00518
00526 ReceiverRow * insertByStartTime(ReceiverRow* x, std::vector<ReceiverRow* >& row);
00527
00528
00529
00530
00531
00532
00533 std::vector<ReceiverRow * > privateRows;
00534
00535
00536
00537
00538
00539
00540
00541
00542 typedef std::vector <std::vector <ReceiverRow* > > ID_TIME_ROWS;
00543 std::map<std::string, ID_TIME_ROWS > context;
00544
00549 std::string Key(Tag spectralWindowId) ;
00550
00551
00552
00553
00559 void getByKeyNoAutoIncNoTime(std::vector <ReceiverRow*>& vin, std::vector <ReceiverRow*>& vout, Tag spectralWindowId);
00560
00561
00562
00563 void error() ;
00564
00565
00572 void fromXML(std::string& xmlDoc) ;
00573
00574 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00575
00580 void setFromMIMEFile(const std::string& directory);
00581
00582
00583
00584 void setFromXMLFile(const std::string& directory);
00585
00593 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00594
00595
00602 void setFromMIME(const std::string & mimeMsg);
00603
00607 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00608
00618 void toFile(std::string directory);
00619
00623 bool loadInProgress;
00624 void checkPresenceInMemory() {
00625 if (!presentInMemory && !loadInProgress) {
00626 loadInProgress = true;
00627 setFromFile(getContainer().getDirectory());
00628 presentInMemory = true;
00629 loadInProgress = false;
00630 }
00631 }
00640 void setFromFile(const std::string& directory);
00641
00642 };
00643
00644 }
00645
00646 #endif