PointingModelTable.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 PointingModelTable_CLASS
00035 #define PointingModelTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <Tag.h>
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #include "CPolarizationType.h"
00060
00061
00062
00063 #include "CReceiverBand.h"
00064
00065
00066
00067
00068
00069
00070
00071
00072 #include <ConversionException.h>
00073 #include <DuplicateKey.h>
00074 #include <UniquenessViolationException.h>
00075 #include <NoSuchRow.h>
00076 #include <DuplicateKey.h>
00077
00078
00079 #ifndef WITHOUT_ACS
00080 #include <asdmIDLC.h>
00081 #endif
00082
00083 #include <Representable.h>
00084
00085 #include <pthread.h>
00086
00087 namespace asdm {
00088
00089
00090
00091
00092 class ASDM;
00093 class PointingModelRow;
00195 class PointingModelTable : public Representable {
00196 friend class ASDM;
00197
00198 public:
00199
00200
00206 static const std::vector<std::string>& getKeyName();
00207
00208
00209 virtual ~PointingModelTable();
00210
00216 ASDM &getContainer() const;
00217
00223 unsigned int size() const;
00224
00232 std::string getName() const;
00233
00241 static std::string name() ;
00242
00247 std::string getVersion() const ;
00248
00254 static const std::vector<std::string>& getAttributesNames();
00255
00261 static const std::vector<std::string>& defaultAttributesNamesInBin();
00262
00266 Entity getEntity() const;
00267
00272 void setEntity(Entity e);
00273
00281 std::string toXML() ;
00282
00283 #ifndef WITHOUT_ACS
00284
00290 asdmIDL::PointingModelTableIDL *toIDL() ;
00291
00299 void toIDL(asdmIDL::PointingModelTableIDL& x) const;
00300
00301 #endif
00302
00303 #ifndef WITHOUT_ACS
00304
00310 void fromIDL(asdmIDL::PointingModelTableIDL x) ;
00311 #endif
00312
00313
00314
00315
00316
00321 PointingModelRow *newRow();
00322
00323
00345 PointingModelRow *newRow(Tag antennaId, int numCoeff, vector<string > coeffName, vector<float > coeffVal, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, string assocNature, int assocPointingModelId);
00346
00347
00348
00361 PointingModelRow *newRow(PointingModelRow *row);
00362
00363
00364
00365
00366
00367
00368
00369
00379 PointingModelRow* add(PointingModelRow* x) ;
00380
00381
00382
00383
00384
00385
00386
00392 std::vector<PointingModelRow *> get() ;
00393
00400 const std::vector<PointingModelRow *>& get() const ;
00401
00402
00403
00404
00405
00417 PointingModelRow* getRowByKey(Tag antennaId, int pointingModelId);
00418
00419
00420
00428 std::vector <PointingModelRow *> getRowByPointingModelId(int);
00429
00430
00431
00455 PointingModelRow* lookup(Tag antennaId, int numCoeff, vector<string > coeffName, vector<float > coeffVal, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, string assocNature, int assocPointingModelId);
00456
00457
00458 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00459 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00460
00461 private:
00462
00471 PointingModelTable (ASDM & container);
00472
00473 ASDM & container;
00474
00475 bool archiveAsBin;
00476 bool fileAsBin ;
00477
00478 std::string version ;
00479
00480 Entity entity;
00481
00482
00483
00484 std::map<std::string,int> noAutoIncIds;
00485 void autoIncrement(std::string key, PointingModelRow* x);
00486
00487
00497 PointingModelRow* checkAndAdd(PointingModelRow* x, bool skipCheckUniqueness=false) ;
00498
00504 void append(PointingModelRow* x) ;
00505
00511 void addWithoutCheckingUnique(PointingModelRow* x) ;
00512
00513
00514
00515
00516
00517
00518
00519
00520 std::vector<PointingModelRow * > privateRows;
00521
00522
00523
00524 std::vector<PointingModelRow *> row;
00525
00526
00527 void error() ;
00528
00529
00536 void fromXML(std::string& xmlDoc) ;
00537
00538 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00539
00544 void setFromMIMEFile(const std::string& directory);
00545
00546
00547
00548 void setFromXMLFile(const std::string& directory);
00549
00557 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00558
00559
00566 void setFromMIME(const std::string & mimeMsg);
00567
00571 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00572
00582 void toFile(std::string directory);
00583
00587 bool loadInProgress;
00588 void checkPresenceInMemory() {
00589 if (!presentInMemory && !loadInProgress) {
00590 loadInProgress = true;
00591 setFromFile(getContainer().getDirectory());
00592 presentInMemory = true;
00593 loadInProgress = false;
00594 }
00595 }
00604 void setFromFile(const std::string& directory);
00605
00606 };
00607
00608 }
00609
00610 #endif