SysPowerTable.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 SysPowerTable_CLASS
00035 #define SysPowerTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <Tag.h>
00045
00046
00047
00048 #include <ArrayTimeInterval.h>
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #include <ConversionException.h>
00067 #include <DuplicateKey.h>
00068 #include <UniquenessViolationException.h>
00069 #include <NoSuchRow.h>
00070 #include <DuplicateKey.h>
00071
00072
00073 #ifndef WITHOUT_ACS
00074 #include <asdmIDLC.h>
00075 #endif
00076
00077 #include <Representable.h>
00078
00079 #include <pthread.h>
00080
00081 namespace asdm {
00082
00083
00084
00085
00086 class ASDM;
00087 class SysPowerRow;
00184 class SysPowerTable : public Representable {
00185 friend class ASDM;
00186
00187 public:
00188
00189
00195 static const std::vector<std::string>& getKeyName();
00196
00197
00198 virtual ~SysPowerTable();
00199
00205 ASDM &getContainer() const;
00206
00212 unsigned int size() const;
00213
00221 std::string getName() const;
00222
00230 static std::string name() ;
00231
00236 std::string getVersion() const ;
00237
00243 static const std::vector<std::string>& getAttributesNames();
00244
00250 static const std::vector<std::string>& defaultAttributesNamesInBin();
00251
00255 Entity getEntity() const;
00256
00261 void setEntity(Entity e);
00262
00270 std::string toXML() ;
00271
00272 #ifndef WITHOUT_ACS
00273
00279 asdmIDL::SysPowerTableIDL *toIDL() ;
00280
00288 void toIDL(asdmIDL::SysPowerTableIDL& x) const;
00289
00290 #endif
00291
00292 #ifndef WITHOUT_ACS
00293
00299 void fromIDL(asdmIDL::SysPowerTableIDL x) ;
00300 #endif
00301
00302
00303
00304
00305
00310 SysPowerRow *newRow();
00311
00312
00328 SysPowerRow *newRow(Tag antennaId, Tag spectralWindowId, int feedId, ArrayTimeInterval timeInterval, int numReceptor);
00329
00330
00331
00344 SysPowerRow *newRow(SysPowerRow *row);
00345
00346
00347
00348
00349
00350
00367 SysPowerRow* add(SysPowerRow* x) ;
00368
00369
00370
00371
00372
00373
00374
00375
00376
00382 std::vector<SysPowerRow *> get() ;
00383
00390 const std::vector<SysPowerRow *>& get() const ;
00391
00392
00403 std::vector <SysPowerRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
00404
00405
00406
00407
00408
00424 SysPowerRow* getRowByKey(Tag antennaId, Tag spectralWindowId, int feedId, ArrayTimeInterval timeInterval);
00425
00426
00427
00428
00429
00447 SysPowerRow* lookup(Tag antennaId, Tag spectralWindowId, int feedId, ArrayTimeInterval timeInterval, int numReceptor);
00448
00449
00450 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00451 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00452
00453 private:
00454
00463 SysPowerTable (ASDM & container);
00464
00465 ASDM & container;
00466
00467 bool archiveAsBin;
00468 bool fileAsBin ;
00469
00470 std::string version ;
00471
00472 Entity entity;
00473
00474
00475
00483 SysPowerRow* checkAndAdd(SysPowerRow* x, bool skipCheckUniqueness=false) ;
00484
00490 void append(SysPowerRow* x) ;
00491
00497 void addWithoutCheckingUnique(SysPowerRow* x) ;
00498
00499
00500
00501
00502
00503
00511 SysPowerRow * insertByStartTime(SysPowerRow* x, std::vector<SysPowerRow* >& row);
00512
00513
00514
00515
00516
00517
00518 std::vector<SysPowerRow * > privateRows;
00519
00520
00521
00522
00523
00524
00525
00526
00527 typedef std::vector <SysPowerRow* > TIME_ROWS;
00528 std::map<std::string, TIME_ROWS > context;
00529
00534 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
00535
00536
00537
00538
00544 void getByKeyNoAutoIncNoTime(std::vector <SysPowerRow*>& vin, std::vector <SysPowerRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId);
00545
00546
00547
00548 void error() ;
00549
00550
00557 void fromXML(std::string& xmlDoc) ;
00558
00559 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00560
00565 void setFromMIMEFile(const std::string& directory);
00566
00567
00568
00569 void setFromXMLFile(const std::string& directory);
00570
00578 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00579
00580
00587 void setFromMIME(const std::string & mimeMsg);
00588
00592 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00593
00603 void toFile(std::string directory);
00604
00608 bool loadInProgress;
00609 void checkPresenceInMemory() {
00610 if (!presentInMemory && !loadInProgress) {
00611 loadInProgress = true;
00612 setFromFile(getContainer().getDirectory());
00613 presentInMemory = true;
00614 loadInProgress = false;
00615 }
00616 }
00625 void setFromFile(const std::string& directory);
00626
00627 };
00628
00629 }
00630
00631 #endif