ConfigDescriptionTable.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 ConfigDescriptionTable_CLASS
00035 #define ConfigDescriptionTable_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 #include "CCorrelationMode.h"
00058
00059
00060
00061
00062
00063
00064
00065 #include "CAtmPhaseCorrection.h"
00066
00067
00068
00069 #include "CProcessorType.h"
00070
00071
00072
00073
00074
00075 #include "CSpectralResolutionType.h"
00076
00077
00078
00079
00080
00081 #include "CSpectralResolutionType.h"
00082
00083
00084
00085
00086 #include <ConversionException.h>
00087 #include <DuplicateKey.h>
00088 #include <UniquenessViolationException.h>
00089 #include <NoSuchRow.h>
00090 #include <DuplicateKey.h>
00091
00092
00093 #ifndef WITHOUT_ACS
00094 #include <asdmIDLC.h>
00095 #endif
00096
00097 #include <Representable.h>
00098
00099 #include <pthread.h>
00100
00101 namespace asdm {
00102
00103
00104
00105
00106 class ASDM;
00107 class ConfigDescriptionRow;
00263 class ConfigDescriptionTable : public Representable {
00264 friend class ASDM;
00265
00266 public:
00267
00268
00274 static const std::vector<std::string>& getKeyName();
00275
00276
00277 virtual ~ConfigDescriptionTable();
00278
00284 ASDM &getContainer() const;
00285
00291 unsigned int size() const;
00292
00300 std::string getName() const;
00301
00309 static std::string name() ;
00310
00315 std::string getVersion() const ;
00316
00322 static const std::vector<std::string>& getAttributesNames();
00323
00329 static const std::vector<std::string>& defaultAttributesNamesInBin();
00330
00334 Entity getEntity() const;
00335
00340 void setEntity(Entity e);
00341
00349 std::string toXML() ;
00350
00351 #ifndef WITHOUT_ACS
00352
00358 asdmIDL::ConfigDescriptionTableIDL *toIDL() ;
00359
00367 void toIDL(asdmIDL::ConfigDescriptionTableIDL& x) const;
00368
00369 #endif
00370
00371 #ifndef WITHOUT_ACS
00372
00378 void fromIDL(asdmIDL::ConfigDescriptionTableIDL x) ;
00379 #endif
00380
00381
00382
00383
00384
00389 ConfigDescriptionRow *newRow();
00390
00391
00423 ConfigDescriptionRow *newRow(int numAntenna, int numDataDescription, int numFeed, CorrelationModeMod::CorrelationMode correlationMode, int numAtmPhaseCorrection, vector<AtmPhaseCorrectionMod::AtmPhaseCorrection > atmPhaseCorrection, ProcessorTypeMod::ProcessorType processorType, SpectralResolutionTypeMod::SpectralResolutionType spectralType, vector<Tag> antennaId, vector<int> feedId, vector<Tag> switchCycleId, vector<Tag> dataDescriptionId, Tag processorId);
00424
00425
00426
00439 ConfigDescriptionRow *newRow(ConfigDescriptionRow *row);
00440
00441
00442
00443
00444
00445
00446
00447
00457 ConfigDescriptionRow* add(ConfigDescriptionRow* x) ;
00458
00459
00460
00461
00462
00463
00464
00470 std::vector<ConfigDescriptionRow *> get() ;
00471
00478 const std::vector<ConfigDescriptionRow *>& get() const ;
00479
00480
00481
00482
00483
00493 ConfigDescriptionRow* getRowByKey(Tag configDescriptionId);
00494
00495
00496
00497
00498
00532 ConfigDescriptionRow* lookup(int numAntenna, int numDataDescription, int numFeed, CorrelationModeMod::CorrelationMode correlationMode, int numAtmPhaseCorrection, vector<AtmPhaseCorrectionMod::AtmPhaseCorrection > atmPhaseCorrection, ProcessorTypeMod::ProcessorType processorType, SpectralResolutionTypeMod::SpectralResolutionType spectralType, vector<Tag> antennaId, vector<int> feedId, vector<Tag> switchCycleId, vector<Tag> dataDescriptionId, Tag processorId);
00533
00534
00535 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00536 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00537
00538 private:
00539
00548 ConfigDescriptionTable (ASDM & container);
00549
00550 ASDM & container;
00551
00552 bool archiveAsBin;
00553 bool fileAsBin ;
00554
00555 std::string version ;
00556
00557 Entity entity;
00558
00559
00560
00561 std::map<std::string,int> noAutoIncIds;
00562 void autoIncrement(std::string key, ConfigDescriptionRow* x);
00563
00564
00574 ConfigDescriptionRow* checkAndAdd(ConfigDescriptionRow* x, bool skipCheckUniqueness=false) ;
00575
00581 void append(ConfigDescriptionRow* x) ;
00582
00588 void addWithoutCheckingUnique(ConfigDescriptionRow* x) ;
00589
00590
00591
00592
00593
00594
00595
00596
00597 std::vector<ConfigDescriptionRow * > privateRows;
00598
00599
00600
00601 std::vector<ConfigDescriptionRow *> row;
00602
00603
00604 void error() ;
00605
00606
00613 void fromXML(std::string& xmlDoc) ;
00614
00615 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00616
00621 void setFromMIMEFile(const std::string& directory);
00622
00623
00624
00625 void setFromXMLFile(const std::string& directory);
00626
00634 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00635
00636
00643 void setFromMIME(const std::string & mimeMsg);
00644
00648 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00649
00659 void toFile(std::string directory);
00660
00664 bool loadInProgress;
00665 void checkPresenceInMemory() {
00666 if (!presentInMemory && !loadInProgress) {
00667 loadInProgress = true;
00668 setFromFile(getContainer().getDirectory());
00669 presentInMemory = true;
00670 loadInProgress = false;
00671 }
00672 }
00681 void setFromFile(const std::string& directory);
00682
00683 };
00684
00685 }
00686
00687 #endif