FocusModelTable.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 FocusModelTable_CLASS
00035 #define FocusModelTable_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 #include "CPolarizationType.h"
00054
00055
00056
00057 #include "CReceiverBand.h"
00058
00059
00060
00061
00062
00063
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 FocusModelRow;
00192 class FocusModelTable : public Representable {
00193 friend class ASDM;
00194
00195 public:
00196
00197
00203 static const std::vector<std::string>& getKeyName();
00204
00205
00206 virtual ~FocusModelTable();
00207
00213 ASDM &getContainer() const;
00214
00220 unsigned int size() const;
00221
00229 std::string getName() const;
00230
00238 static std::string name() ;
00239
00244 std::string getVersion() const ;
00245
00251 static const std::vector<std::string>& getAttributesNames();
00252
00258 static const std::vector<std::string>& defaultAttributesNamesInBin();
00259
00263 Entity getEntity() const;
00264
00269 void setEntity(Entity e);
00270
00278 std::string toXML() ;
00279
00280 #ifndef WITHOUT_ACS
00281
00287 asdmIDL::FocusModelTableIDL *toIDL() ;
00288
00296 void toIDL(asdmIDL::FocusModelTableIDL& x) const;
00297
00298 #endif
00299
00300 #ifndef WITHOUT_ACS
00301
00307 void fromIDL(asdmIDL::FocusModelTableIDL x) ;
00308 #endif
00309
00310
00311
00312
00313
00318 FocusModelRow *newRow();
00319
00320
00344 FocusModelRow *newRow(Tag antennaId, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, int numCoeff, vector<string > coeffName, vector<string > coeffFormula, vector<float > coeffVal, string assocNature, int assocFocusModelId);
00345
00346
00347
00360 FocusModelRow *newRow(FocusModelRow *row);
00361
00362
00363
00364
00365
00366
00367
00368
00378 FocusModelRow* add(FocusModelRow* x) ;
00379
00380
00381
00382
00383
00384
00385
00391 std::vector<FocusModelRow *> get() ;
00392
00399 const std::vector<FocusModelRow *>& get() const ;
00400
00401
00402
00403
00404
00416 FocusModelRow* getRowByKey(Tag antennaId, int focusModelId);
00417
00418
00419
00427 std::vector <FocusModelRow *> getRowByFocusModelId(int);
00428
00429
00430
00456 FocusModelRow* lookup(Tag antennaId, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, int numCoeff, vector<string > coeffName, vector<string > coeffFormula, vector<float > coeffVal, string assocNature, int assocFocusModelId);
00457
00458
00459 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00460 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00461
00462 private:
00463
00472 FocusModelTable (ASDM & container);
00473
00474 ASDM & container;
00475
00476 bool archiveAsBin;
00477 bool fileAsBin ;
00478
00479 std::string version ;
00480
00481 Entity entity;
00482
00483
00484
00485 std::map<std::string,int> noAutoIncIds;
00486 void autoIncrement(std::string key, FocusModelRow* x);
00487
00488
00498 FocusModelRow* checkAndAdd(FocusModelRow* x, bool skipCheckUniqueness=false) ;
00499
00505 void append(FocusModelRow* x) ;
00506
00512 void addWithoutCheckingUnique(FocusModelRow* x) ;
00513
00514
00515
00516
00517
00518
00519
00520
00521 std::vector<FocusModelRow * > privateRows;
00522
00523
00524
00525 std::vector<FocusModelRow *> row;
00526
00527
00528 void error() ;
00529
00530
00537 void fromXML(std::string& xmlDoc) ;
00538
00539 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00540
00545 void setFromMIMEFile(const std::string& directory);
00546
00547
00548
00549 void setFromXMLFile(const std::string& directory);
00550
00558 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00559
00560
00567 void setFromMIME(const std::string & mimeMsg);
00568
00572 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00573
00583 void toFile(std::string directory);
00584
00588 bool loadInProgress;
00589 void checkPresenceInMemory() {
00590 if (!presentInMemory && !loadInProgress) {
00591 loadInProgress = true;
00592 setFromFile(getContainer().getDirectory());
00593 presentInMemory = true;
00594 loadInProgress = false;
00595 }
00596 }
00605 void setFromFile(const std::string& directory);
00606
00607 };
00608
00609 }
00610
00611 #endif