SBSummaryTable.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 SBSummaryTable_CLASS
00035 #define SBSummaryTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Angle.h>
00049
00050
00051
00052 #include <Interval.h>
00053
00054
00055
00056 #include <Tag.h>
00057
00058
00059
00060 #include <EntityRef.h>
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include "CReceiverBand.h"
00078
00079
00080
00081 #include "CSBType.h"
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include "CDirectionReferenceCode.h"
00104
00105
00106
00107
00108
00109
00110 #include <ConversionException.h>
00111 #include <DuplicateKey.h>
00112 #include <UniquenessViolationException.h>
00113 #include <NoSuchRow.h>
00114 #include <DuplicateKey.h>
00115
00116
00117 #ifndef WITHOUT_ACS
00118 #include <asdmIDLC.h>
00119 #endif
00120
00121 #include <Representable.h>
00122
00123 #include <pthread.h>
00124
00125 namespace asdm {
00126
00127
00128
00129
00130 class ASDM;
00131 class SBSummaryRow;
00287 class SBSummaryTable : public Representable {
00288 friend class ASDM;
00289
00290 public:
00291
00292
00298 static const std::vector<std::string>& getKeyName();
00299
00300
00301 virtual ~SBSummaryTable();
00302
00308 ASDM &getContainer() const;
00309
00315 unsigned int size() const;
00316
00324 std::string getName() const;
00325
00333 static std::string name() ;
00334
00339 std::string getVersion() const ;
00340
00346 static const std::vector<std::string>& getAttributesNames();
00347
00353 static const std::vector<std::string>& defaultAttributesNamesInBin();
00354
00358 Entity getEntity() const;
00359
00364 void setEntity(Entity e);
00365
00373 std::string toXML() ;
00374
00375 #ifndef WITHOUT_ACS
00376
00382 asdmIDL::SBSummaryTableIDL *toIDL() ;
00383
00391 void toIDL(asdmIDL::SBSummaryTableIDL& x) const;
00392
00393 #endif
00394
00395 #ifndef WITHOUT_ACS
00396
00402 void fromIDL(asdmIDL::SBSummaryTableIDL x) ;
00403 #endif
00404
00405
00406
00407
00408
00413 SBSummaryRow *newRow();
00414
00415
00449 SBSummaryRow *newRow(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetUID, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, int numObservingMode, vector<string > observingMode, int numberRepeats, int numScienceGoal, vector<string > scienceGoal, int numWeatherConstraint, vector<string > weatherConstraint);
00450
00451
00452
00465 SBSummaryRow *newRow(SBSummaryRow *row);
00466
00467
00468
00469
00470
00471
00472
00473
00483 SBSummaryRow* add(SBSummaryRow* x) ;
00484
00485
00486
00487
00488
00489
00490
00496 std::vector<SBSummaryRow *> get() ;
00497
00504 const std::vector<SBSummaryRow *>& get() const ;
00505
00506
00507
00508
00509
00519 SBSummaryRow* getRowByKey(Tag sBSummaryId);
00520
00521
00522
00523
00524
00560 SBSummaryRow* lookup(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetUID, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, int numObservingMode, vector<string > observingMode, int numberRepeats, int numScienceGoal, vector<string > scienceGoal, int numWeatherConstraint, vector<string > weatherConstraint);
00561
00562
00563 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00564 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00565
00566 private:
00567
00576 SBSummaryTable (ASDM & container);
00577
00578 ASDM & container;
00579
00580 bool archiveAsBin;
00581 bool fileAsBin ;
00582
00583 std::string version ;
00584
00585 Entity entity;
00586
00587
00588
00589 std::map<std::string,int> noAutoIncIds;
00590 void autoIncrement(std::string key, SBSummaryRow* x);
00591
00592
00602 SBSummaryRow* checkAndAdd(SBSummaryRow* x, bool skipCheckUniqueness=false) ;
00603
00609 void append(SBSummaryRow* x) ;
00610
00616 void addWithoutCheckingUnique(SBSummaryRow* x) ;
00617
00618
00619
00620
00621
00622
00623
00624
00625 std::vector<SBSummaryRow * > privateRows;
00626
00627
00628
00629 std::vector<SBSummaryRow *> row;
00630
00631
00632 void error() ;
00633
00634
00641 void fromXML(std::string& xmlDoc) ;
00642
00643 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00644
00649 void setFromMIMEFile(const std::string& directory);
00650
00651
00652
00653 void setFromXMLFile(const std::string& directory);
00654
00662 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00663
00664
00671 void setFromMIME(const std::string & mimeMsg);
00672
00676 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00677
00687 void toFile(std::string directory);
00688
00692 bool loadInProgress;
00693 void checkPresenceInMemory() {
00694 if (!presentInMemory && !loadInProgress) {
00695 loadInProgress = true;
00696 setFromFile(getContainer().getDirectory());
00697 presentInMemory = true;
00698 loadInProgress = false;
00699 }
00700 }
00709 void setFromFile(const std::string& directory);
00710
00711 };
00712
00713 }
00714
00715 #endif