CalDataTable.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 CalDataTable_CLASS
00035 #define CalDataTable_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 <EntityRef.h>
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #include "CCalDataOrigin.h"
00068
00069
00070
00071 #include "CCalType.h"
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 #include "CAssociatedCalNature.h"
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #include "CScanIntent.h"
00092
00093
00094
00095
00096 #include <ConversionException.h>
00097 #include <DuplicateKey.h>
00098 #include <UniquenessViolationException.h>
00099 #include <NoSuchRow.h>
00100 #include <DuplicateKey.h>
00101
00102
00103 #ifndef WITHOUT_ACS
00104 #include <asdmIDLC.h>
00105 #endif
00106
00107 #include <Representable.h>
00108
00109 #include <pthread.h>
00110
00111 namespace asdm {
00112
00113
00114
00115
00116 class ASDM;
00117 class CalDataRow;
00245 class CalDataTable : public Representable {
00246 friend class ASDM;
00247
00248 public:
00249
00250
00256 static const std::vector<std::string>& getKeyName();
00257
00258
00259 virtual ~CalDataTable();
00260
00266 ASDM &getContainer() const;
00267
00273 unsigned int size() const;
00274
00282 std::string getName() const;
00283
00291 static std::string name() ;
00292
00297 std::string getVersion() const ;
00298
00304 static const std::vector<std::string>& getAttributesNames();
00305
00311 static const std::vector<std::string>& defaultAttributesNamesInBin();
00312
00316 Entity getEntity() const;
00317
00322 void setEntity(Entity e);
00323
00331 std::string toXML() ;
00332
00333 #ifndef WITHOUT_ACS
00334
00340 asdmIDL::CalDataTableIDL *toIDL() ;
00341
00349 void toIDL(asdmIDL::CalDataTableIDL& x) const;
00350
00351 #endif
00352
00353 #ifndef WITHOUT_ACS
00354
00360 void fromIDL(asdmIDL::CalDataTableIDL x) ;
00361 #endif
00362
00363
00364
00365
00366
00371 CalDataRow *newRow();
00372
00373
00393 CalDataRow *newRow(ArrayTime startTimeObserved, ArrayTime endTimeObserved, EntityRef execBlockUID, CalDataOriginMod::CalDataOrigin calDataType, CalTypeMod::CalType calType, int numScan, vector<int > scanSet);
00394
00395
00396
00409 CalDataRow *newRow(CalDataRow *row);
00410
00411
00412
00413
00414
00415
00416
00417
00427 CalDataRow* add(CalDataRow* x) ;
00428
00429
00430
00431
00432
00433
00434
00440 std::vector<CalDataRow *> get() ;
00441
00448 const std::vector<CalDataRow *>& get() const ;
00449
00450
00451
00452
00453
00463 CalDataRow* getRowByKey(Tag calDataId);
00464
00465
00466
00467
00468
00490 CalDataRow* lookup(ArrayTime startTimeObserved, ArrayTime endTimeObserved, EntityRef execBlockUID, CalDataOriginMod::CalDataOrigin calDataType, CalTypeMod::CalType calType, int numScan, vector<int > scanSet);
00491
00492
00493 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00494 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00495
00496 private:
00497
00506 CalDataTable (ASDM & container);
00507
00508 ASDM & container;
00509
00510 bool archiveAsBin;
00511 bool fileAsBin ;
00512
00513 std::string version ;
00514
00515 Entity entity;
00516
00517
00518
00519 std::map<std::string,int> noAutoIncIds;
00520 void autoIncrement(std::string key, CalDataRow* x);
00521
00522
00532 CalDataRow* checkAndAdd(CalDataRow* x, bool skipCheckUniqueness=false) ;
00533
00539 void append(CalDataRow* x) ;
00540
00546 void addWithoutCheckingUnique(CalDataRow* x) ;
00547
00548
00549
00550
00551
00552
00553
00554
00555 std::vector<CalDataRow * > privateRows;
00556
00557
00558
00559 std::vector<CalDataRow *> row;
00560
00561
00562 void error() ;
00563
00564
00571 void fromXML(std::string& xmlDoc) ;
00572
00573 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00574
00579 void setFromMIMEFile(const std::string& directory);
00580
00581
00582
00583 void setFromXMLFile(const std::string& directory);
00584
00592 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00593
00594
00601 void setFromMIME(const std::string & mimeMsg);
00602
00606 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00607
00617 void toFile(std::string directory);
00618
00622 bool loadInProgress;
00623 void checkPresenceInMemory() {
00624 if (!presentInMemory && !loadInProgress) {
00625 loadInProgress = true;
00626 setFromFile(getContainer().getDirectory());
00627 presentInMemory = true;
00628 loadInProgress = false;
00629 }
00630 }
00639 void setFromFile(const std::string& directory);
00640
00641 };
00642
00643 }
00644
00645 #endif