FlagTable.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 FlagTable_CLASS
00035 #define FlagTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Tag.h>
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #include "CPolarizationType.h"
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 FlagRow;
00211 class FlagTable : public Representable {
00212 friend class ASDM;
00213
00214 public:
00215
00216
00222 static const std::vector<std::string>& getKeyName();
00223
00224
00225 virtual ~FlagTable();
00226
00232 ASDM &getContainer() const;
00233
00239 unsigned int size() const;
00240
00248 std::string getName() const;
00249
00257 static std::string name() ;
00258
00263 std::string getVersion() const ;
00264
00270 static const std::vector<std::string>& getAttributesNames();
00271
00277 static const std::vector<std::string>& defaultAttributesNamesInBin();
00278
00282 Entity getEntity() const;
00283
00288 void setEntity(Entity e);
00289
00297 std::string toXML() ;
00298
00299 #ifndef WITHOUT_ACS
00300
00306 asdmIDL::FlagTableIDL *toIDL() ;
00307
00315 void toIDL(asdmIDL::FlagTableIDL& x) const;
00316
00317 #endif
00318
00319 #ifndef WITHOUT_ACS
00320
00326 void fromIDL(asdmIDL::FlagTableIDL x) ;
00327 #endif
00328
00329
00330
00331
00332
00337 FlagRow *newRow();
00338
00339
00355 FlagRow *newRow(ArrayTime startTime, ArrayTime endTime, string reason, int numAntenna, vector<Tag> antennaId);
00356
00357
00358
00371 FlagRow *newRow(FlagRow *row);
00372
00373
00374
00375
00376
00377
00378
00379
00389 FlagRow* add(FlagRow* x) ;
00390
00391
00392
00393
00394
00395
00396
00402 std::vector<FlagRow *> get() ;
00403
00410 const std::vector<FlagRow *>& get() const ;
00411
00412
00413
00414
00415
00425 FlagRow* getRowByKey(Tag flagId);
00426
00427
00428
00429
00430
00448 FlagRow* lookup(ArrayTime startTime, ArrayTime endTime, string reason, int numAntenna, vector<Tag> antennaId);
00449
00450
00451 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00452 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00453
00454 private:
00455
00464 FlagTable (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
00477 std::map<std::string,int> noAutoIncIds;
00478 void autoIncrement(std::string key, FlagRow* x);
00479
00480
00490 FlagRow* checkAndAdd(FlagRow* x, bool skipCheckUniqueness=false) ;
00491
00497 void append(FlagRow* x) ;
00498
00504 void addWithoutCheckingUnique(FlagRow* x) ;
00505
00506
00507
00508
00509
00510
00511
00512
00513 std::vector<FlagRow * > privateRows;
00514
00515
00516
00517 std::vector<FlagRow *> row;
00518
00519
00520 void error() ;
00521
00522
00529 void fromXML(std::string& xmlDoc) ;
00530
00531 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00532
00537 void setFromMIMEFile(const std::string& directory);
00538
00539
00540
00541 void setFromXMLFile(const std::string& directory);
00542
00550 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00551
00552
00559 void setFromMIME(const std::string & mimeMsg);
00560
00564 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00565
00575 void toFile(std::string directory);
00576
00580 bool loadInProgress;
00581 void checkPresenceInMemory() {
00582 if (!presentInMemory && !loadInProgress) {
00583 loadInProgress = true;
00584 setFromFile(getContainer().getDirectory());
00585 presentInMemory = true;
00586 loadInProgress = false;
00587 }
00588 }
00597 void setFromFile(const std::string& directory);
00598
00599 };
00600
00601 }
00602
00603 #endif