AntennaTable.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 AntennaTable_CLASS
00035 #define AntennaTable_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 #include <Length.h>
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #include "CAntennaMake.h"
00064
00065
00066
00067 #include "CAntennaType.h"
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #include <ConversionException.h>
00081 #include <DuplicateKey.h>
00082 #include <UniquenessViolationException.h>
00083 #include <NoSuchRow.h>
00084 #include <DuplicateKey.h>
00085
00086
00087 #ifndef WITHOUT_ACS
00088 #include <asdmIDLC.h>
00089 #endif
00090
00091 #include <Representable.h>
00092
00093 #include <pthread.h>
00094
00095 namespace asdm {
00096
00097
00098
00099
00100 class ASDM;
00101 class AntennaRow;
00201 class AntennaTable : public Representable {
00202 friend class ASDM;
00203
00204 public:
00205
00206
00212 static const std::vector<std::string>& getKeyName();
00213
00214
00215 virtual ~AntennaTable();
00216
00222 ASDM &getContainer() const;
00223
00229 unsigned int size() const;
00230
00238 std::string getName() const;
00239
00247 static std::string name() ;
00248
00253 std::string getVersion() const ;
00254
00260 static const std::vector<std::string>& getAttributesNames();
00261
00267 static const std::vector<std::string>& defaultAttributesNamesInBin();
00268
00272 Entity getEntity() const;
00273
00278 void setEntity(Entity e);
00279
00287 std::string toXML() ;
00288
00289 #ifndef WITHOUT_ACS
00290
00296 asdmIDL::AntennaTableIDL *toIDL() ;
00297
00305 void toIDL(asdmIDL::AntennaTableIDL& x) const;
00306
00307 #endif
00308
00309 #ifndef WITHOUT_ACS
00310
00316 void fromIDL(asdmIDL::AntennaTableIDL x) ;
00317 #endif
00318
00319
00320
00321
00322
00327 AntennaRow *newRow();
00328
00329
00351 AntennaRow *newRow(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId);
00352
00353
00354
00367 AntennaRow *newRow(AntennaRow *row);
00368
00369
00370
00371
00372
00373
00374
00375
00385 AntennaRow* add(AntennaRow* x) ;
00386
00387
00388
00389
00390
00391
00392
00398 std::vector<AntennaRow *> get() ;
00399
00406 const std::vector<AntennaRow *>& get() const ;
00407
00408
00409
00410
00411
00421 AntennaRow* getRowByKey(Tag antennaId);
00422
00423
00424
00425
00426
00450 AntennaRow* lookup(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId);
00451
00452
00453 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00454 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00455
00456 private:
00457
00466 AntennaTable (ASDM & container);
00467
00468 ASDM & container;
00469
00470 bool archiveAsBin;
00471 bool fileAsBin ;
00472
00473 std::string version ;
00474
00475 Entity entity;
00476
00477
00478
00479 std::map<std::string,int> noAutoIncIds;
00480 void autoIncrement(std::string key, AntennaRow* x);
00481
00482
00492 AntennaRow* checkAndAdd(AntennaRow* x, bool skipCheckUniqueness=false) ;
00493
00499 void append(AntennaRow* x) ;
00500
00506 void addWithoutCheckingUnique(AntennaRow* x) ;
00507
00508
00509
00510
00511
00512
00513
00514
00515 std::vector<AntennaRow * > privateRows;
00516
00517
00518
00519 std::vector<AntennaRow *> row;
00520
00521
00522 void error() ;
00523
00524
00531 void fromXML(std::string& xmlDoc) ;
00532
00533 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00534
00539 void setFromMIMEFile(const std::string& directory);
00540
00541
00542
00543 void setFromXMLFile(const std::string& directory);
00544
00552 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00553
00554
00561 void setFromMIME(const std::string & mimeMsg);
00562
00566 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00567
00577 void toFile(std::string directory);
00578
00582 bool loadInProgress;
00583 void checkPresenceInMemory() {
00584 if (!presentInMemory && !loadInProgress) {
00585 loadInProgress = true;
00586 setFromFile(getContainer().getDirectory());
00587 presentInMemory = true;
00588 loadInProgress = false;
00589 }
00590 }
00599 void setFromFile(const std::string& directory);
00600
00601 };
00602
00603 }
00604
00605 #endif