FocusTable.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 FocusTable_CLASS
00035 #define FocusTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <Angle.h>
00045
00046
00047
00048 #include <Tag.h>
00049
00050
00051
00052 #include <Length.h>
00053
00054
00055
00056 #include <ArrayTimeInterval.h>
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #include <ConversionException.h>
00077 #include <DuplicateKey.h>
00078 #include <UniquenessViolationException.h>
00079 #include <NoSuchRow.h>
00080 #include <DuplicateKey.h>
00081
00082
00083 #ifndef WITHOUT_ACS
00084 #include <asdmIDLC.h>
00085 #endif
00086
00087 #include <Representable.h>
00088
00089 #include <pthread.h>
00090
00091 namespace asdm {
00092
00093
00094
00095
00096 class ASDM;
00097 class FocusRow;
00185 class FocusTable : public Representable {
00186 friend class ASDM;
00187
00188 public:
00189
00190
00196 static const std::vector<std::string>& getKeyName();
00197
00198
00199 virtual ~FocusTable();
00200
00206 ASDM &getContainer() const;
00207
00213 unsigned int size() const;
00214
00222 std::string getName() const;
00223
00231 static std::string name() ;
00232
00237 std::string getVersion() const ;
00238
00244 static const std::vector<std::string>& getAttributesNames();
00245
00251 static const std::vector<std::string>& defaultAttributesNamesInBin();
00252
00256 Entity getEntity() const;
00257
00262 void setEntity(Entity e);
00263
00271 std::string toXML() ;
00272
00273 #ifndef WITHOUT_ACS
00274
00280 asdmIDL::FocusTableIDL *toIDL() ;
00281
00289 void toIDL(asdmIDL::FocusTableIDL& x) const;
00290
00291 #endif
00292
00293 #ifndef WITHOUT_ACS
00294
00300 void fromIDL(asdmIDL::FocusTableIDL x) ;
00301 #endif
00302
00303
00304
00305
00306
00311 FocusRow *newRow();
00312
00313
00331 FocusRow *newRow(Tag antennaId, ArrayTimeInterval timeInterval, bool focusTracking, vector<Length > focusOffset, vector<Angle > focusRotationOffset, int focusModelId);
00332
00333
00334
00347 FocusRow *newRow(FocusRow *row);
00348
00349
00350
00351
00352
00353
00370 FocusRow* add(FocusRow* x) ;
00371
00372
00373
00374
00375
00376
00377
00378
00379
00385 std::vector<FocusRow *> get() ;
00386
00393 const std::vector<FocusRow *>& get() const ;
00394
00395
00406 std::vector <FocusRow*> *getByContext(Tag antennaId);
00407
00408
00409
00410
00411
00423 FocusRow* getRowByKey(Tag antennaId, ArrayTimeInterval timeInterval);
00424
00425
00426
00427
00428
00448 FocusRow* lookup(Tag antennaId, ArrayTimeInterval timeInterval, bool focusTracking, vector<Length > focusOffset, vector<Angle > focusRotationOffset, int focusModelId);
00449
00450
00451 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00452 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00453
00454 private:
00455
00464 FocusTable (ASDM & container);
00465
00466 ASDM & container;
00467
00468 bool archiveAsBin;
00469 bool fileAsBin ;
00470
00471 std::string version ;
00472
00473 Entity entity;
00474
00475
00476
00484 FocusRow* checkAndAdd(FocusRow* x, bool skipCheckUniqueness=false) ;
00485
00491 void append(FocusRow* x) ;
00492
00498 void addWithoutCheckingUnique(FocusRow* x) ;
00499
00500
00501
00502
00503
00504
00512 FocusRow * insertByStartTime(FocusRow* x, std::vector<FocusRow* >& row);
00513
00514
00515
00516
00517
00518
00519 std::vector<FocusRow * > privateRows;
00520
00521
00522
00523
00524
00525
00526
00527
00528 typedef std::vector <FocusRow* > TIME_ROWS;
00529 std::map<std::string, TIME_ROWS > context;
00530
00535 std::string Key(Tag antennaId) ;
00536
00537
00538
00539
00545 void getByKeyNoAutoIncNoTime(std::vector <FocusRow*>& vin, std::vector <FocusRow*>& vout, Tag antennaId);
00546
00547
00548
00549 void error() ;
00550
00551
00558 void fromXML(std::string& xmlDoc) ;
00559
00560 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00561
00566 void setFromMIMEFile(const std::string& directory);
00567
00568
00569
00570 void setFromXMLFile(const std::string& directory);
00571
00579 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00580
00581
00588 void setFromMIME(const std::string & mimeMsg);
00589
00593 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00594
00604 void toFile(std::string directory);
00605
00609 bool loadInProgress;
00610 void checkPresenceInMemory() {
00611 if (!presentInMemory && !loadInProgress) {
00612 loadInProgress = true;
00613 setFromFile(getContainer().getDirectory());
00614 presentInMemory = true;
00615 loadInProgress = false;
00616 }
00617 }
00626 void setFromFile(const std::string& directory);
00627
00628 };
00629
00630 }
00631
00632 #endif