DopplerTable.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 DopplerTable_CLASS
00035 #define DopplerTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include "CDopplerReferenceCode.h"
00052
00053
00054
00055
00056 #include <ConversionException.h>
00057 #include <DuplicateKey.h>
00058 #include <UniquenessViolationException.h>
00059 #include <NoSuchRow.h>
00060 #include <DuplicateKey.h>
00061
00062
00063 #ifndef WITHOUT_ACS
00064 #include <asdmIDLC.h>
00065 #endif
00066
00067 #include <Representable.h>
00068
00069 #include <pthread.h>
00070
00071 namespace asdm {
00072
00073
00074
00075
00076 class ASDM;
00077 class DopplerRow;
00134 class DopplerTable : public Representable {
00135 friend class ASDM;
00136
00137 public:
00138
00139
00145 static const std::vector<std::string>& getKeyName();
00146
00147
00148 virtual ~DopplerTable();
00149
00155 ASDM &getContainer() const;
00156
00162 unsigned int size() const;
00163
00171 std::string getName() const;
00172
00180 static std::string name() ;
00181
00186 std::string getVersion() const ;
00187
00193 static const std::vector<std::string>& getAttributesNames();
00194
00200 static const std::vector<std::string>& defaultAttributesNamesInBin();
00201
00205 Entity getEntity() const;
00206
00211 void setEntity(Entity e);
00212
00220 std::string toXML() ;
00221
00222 #ifndef WITHOUT_ACS
00223
00229 asdmIDL::DopplerTableIDL *toIDL() ;
00230
00238 void toIDL(asdmIDL::DopplerTableIDL& x) const;
00239
00240 #endif
00241
00242 #ifndef WITHOUT_ACS
00243
00249 void fromIDL(asdmIDL::DopplerTableIDL x) ;
00250 #endif
00251
00252
00253
00254
00255
00260 DopplerRow *newRow();
00261
00262
00274 DopplerRow *newRow(int sourceId, int transitionIndex, DopplerReferenceCodeMod::DopplerReferenceCode velDef);
00275
00276
00277
00290 DopplerRow *newRow(DopplerRow *row);
00291
00292
00293
00294
00295
00296
00297
00298
00308 DopplerRow* add(DopplerRow* x) ;
00309
00310
00311
00312
00313
00314
00315
00321 std::vector<DopplerRow *> get() ;
00322
00329 const std::vector<DopplerRow *>& get() const ;
00330
00331
00332
00333
00334
00346 DopplerRow* getRowByKey(int dopplerId, int sourceId);
00347
00348
00349
00357 std::vector <DopplerRow *> getRowByDopplerId(int);
00358
00359
00360
00374 DopplerRow* lookup(int sourceId, int transitionIndex, DopplerReferenceCodeMod::DopplerReferenceCode velDef);
00375
00376
00377 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00378 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00379
00380 private:
00381
00390 DopplerTable (ASDM & container);
00391
00392 ASDM & container;
00393
00394 bool archiveAsBin;
00395 bool fileAsBin ;
00396
00397 std::string version ;
00398
00399 Entity entity;
00400
00401
00402
00403 std::map<std::string,int> noAutoIncIds;
00404 void autoIncrement(std::string key, DopplerRow* x);
00405
00406
00416 DopplerRow* checkAndAdd(DopplerRow* x, bool skipCheckUniqueness=false) ;
00417
00423 void append(DopplerRow* x) ;
00424
00430 void addWithoutCheckingUnique(DopplerRow* x) ;
00431
00432
00433
00434
00435
00436
00437
00438
00439 std::vector<DopplerRow * > privateRows;
00440
00441
00442
00443 std::vector<DopplerRow *> row;
00444
00445
00446 void error() ;
00447
00448
00455 void fromXML(std::string& xmlDoc) ;
00456
00457 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00458
00463 void setFromMIMEFile(const std::string& directory);
00464
00465
00466
00467 void setFromXMLFile(const std::string& directory);
00468
00476 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00477
00478
00485 void setFromMIME(const std::string & mimeMsg);
00486
00490 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00491
00501 void toFile(std::string directory);
00502
00506 bool loadInProgress;
00507 void checkPresenceInMemory() {
00508 if (!presentInMemory && !loadInProgress) {
00509 loadInProgress = true;
00510 setFromFile(getContainer().getDirectory());
00511 presentInMemory = true;
00512 loadInProgress = false;
00513 }
00514 }
00523 void setFromFile(const std::string& directory);
00524
00525 };
00526
00527 }
00528
00529 #endif