CorrelatorModeTable.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 CorrelatorModeTable_CLASS
00035 #define CorrelatorModeTable_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 #include "CBasebandName.h"
00056
00057
00058
00059
00060
00061 #include "CAccumMode.h"
00062
00063
00064
00065
00066
00067
00068
00069 #include "CAxisName.h"
00070
00071
00072
00073 #include "CFilterMode.h"
00074
00075
00076
00077 #include "CCorrelatorName.h"
00078
00079
00080
00081
00082 #include <ConversionException.h>
00083 #include <DuplicateKey.h>
00084 #include <UniquenessViolationException.h>
00085 #include <NoSuchRow.h>
00086 #include <DuplicateKey.h>
00087
00088
00089 #ifndef WITHOUT_ACS
00090 #include <asdmIDLC.h>
00091 #endif
00092
00093 #include <Representable.h>
00094
00095 #include <pthread.h>
00096
00097 namespace asdm {
00098
00099
00100
00101
00102 class ASDM;
00103 class CorrelatorModeRow;
00200 class CorrelatorModeTable : public Representable {
00201 friend class ASDM;
00202
00203 public:
00204
00205
00211 static const std::vector<std::string>& getKeyName();
00212
00213
00214 virtual ~CorrelatorModeTable();
00215
00221 ASDM &getContainer() const;
00222
00228 unsigned int size() const;
00229
00237 std::string getName() const;
00238
00246 static std::string name() ;
00247
00252 std::string getVersion() const ;
00253
00259 static const std::vector<std::string>& getAttributesNames();
00260
00266 static const std::vector<std::string>& defaultAttributesNamesInBin();
00267
00271 Entity getEntity() const;
00272
00277 void setEntity(Entity e);
00278
00286 std::string toXML() ;
00287
00288 #ifndef WITHOUT_ACS
00289
00295 asdmIDL::CorrelatorModeTableIDL *toIDL() ;
00296
00304 void toIDL(asdmIDL::CorrelatorModeTableIDL& x) const;
00305
00306 #endif
00307
00308 #ifndef WITHOUT_ACS
00309
00315 void fromIDL(asdmIDL::CorrelatorModeTableIDL x) ;
00316 #endif
00317
00318
00319
00320
00321
00326 CorrelatorModeRow *newRow();
00327
00328
00352 CorrelatorModeRow *newRow(int numBaseband, vector<BasebandNameMod::BasebandName > basebandNames, vector<int > basebandConfig, AccumModeMod::AccumMode accumMode, int binMode, int numAxes, vector<AxisNameMod::AxisName > axesOrderArray, vector<FilterModeMod::FilterMode > filterMode, CorrelatorNameMod::CorrelatorName correlatorName);
00353
00354
00355
00368 CorrelatorModeRow *newRow(CorrelatorModeRow *row);
00369
00370
00371
00372
00373
00374
00375
00376
00386 CorrelatorModeRow* add(CorrelatorModeRow* x) ;
00387
00388
00389
00390
00391
00392
00393
00399 std::vector<CorrelatorModeRow *> get() ;
00400
00407 const std::vector<CorrelatorModeRow *>& get() const ;
00408
00409
00410
00411
00412
00422 CorrelatorModeRow* getRowByKey(Tag correlatorModeId);
00423
00424
00425
00426
00427
00453 CorrelatorModeRow* lookup(int numBaseband, vector<BasebandNameMod::BasebandName > basebandNames, vector<int > basebandConfig, AccumModeMod::AccumMode accumMode, int binMode, int numAxes, vector<AxisNameMod::AxisName > axesOrderArray, vector<FilterModeMod::FilterMode > filterMode, CorrelatorNameMod::CorrelatorName correlatorName);
00454
00455
00456 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00457 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00458
00459 private:
00460
00469 CorrelatorModeTable (ASDM & container);
00470
00471 ASDM & container;
00472
00473 bool archiveAsBin;
00474 bool fileAsBin ;
00475
00476 std::string version ;
00477
00478 Entity entity;
00479
00480
00481
00482 std::map<std::string,int> noAutoIncIds;
00483 void autoIncrement(std::string key, CorrelatorModeRow* x);
00484
00485
00495 CorrelatorModeRow* checkAndAdd(CorrelatorModeRow* x, bool skipCheckUniqueness=false) ;
00496
00502 void append(CorrelatorModeRow* x) ;
00503
00509 void addWithoutCheckingUnique(CorrelatorModeRow* x) ;
00510
00511
00512
00513
00514
00515
00516
00517
00518 std::vector<CorrelatorModeRow * > privateRows;
00519
00520
00521
00522 std::vector<CorrelatorModeRow *> row;
00523
00524
00525 void error() ;
00526
00527
00534 void fromXML(std::string& xmlDoc) ;
00535
00536 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00537
00542 void setFromMIMEFile(const std::string& directory);
00543
00544
00545
00546 void setFromXMLFile(const std::string& directory);
00547
00555 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00556
00557
00564 void setFromMIME(const std::string & mimeMsg);
00565
00569 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00570
00580 void toFile(std::string directory);
00581
00585 bool loadInProgress;
00586 void checkPresenceInMemory() {
00587 if (!presentInMemory && !loadInProgress) {
00588 loadInProgress = true;
00589 setFromFile(getContainer().getDirectory());
00590 presentInMemory = true;
00591 loadInProgress = false;
00592 }
00593 }
00602 void setFromFile(const std::string& directory);
00603
00604 };
00605
00606 }
00607
00608 #endif