FlagCmdTable.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 FlagCmdTable_CLASS
00035 #define FlagCmdTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTimeInterval.h>
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #include <ConversionException.h>
00067 #include <DuplicateKey.h>
00068 #include <UniquenessViolationException.h>
00069 #include <NoSuchRow.h>
00070 #include <DuplicateKey.h>
00071
00072
00073 #ifndef WITHOUT_ACS
00074 #include <asdmIDLC.h>
00075 #endif
00076
00077 #include <Representable.h>
00078
00079 #include <pthread.h>
00080
00081 namespace asdm {
00082
00083
00084
00085
00086 class ASDM;
00087 class FlagCmdRow;
00163 class FlagCmdTable : public Representable {
00164 friend class ASDM;
00165
00166 public:
00167
00168
00174 static const std::vector<std::string>& getKeyName();
00175
00176
00177 virtual ~FlagCmdTable();
00178
00184 ASDM &getContainer() const;
00185
00191 unsigned int size() const;
00192
00200 std::string getName() const;
00201
00209 static std::string name() ;
00210
00215 std::string getVersion() const ;
00216
00222 static const std::vector<std::string>& getAttributesNames();
00223
00229 static const std::vector<std::string>& defaultAttributesNamesInBin();
00230
00234 Entity getEntity() const;
00235
00240 void setEntity(Entity e);
00241
00249 std::string toXML() ;
00250
00251 #ifndef WITHOUT_ACS
00252
00258 asdmIDL::FlagCmdTableIDL *toIDL() ;
00259
00267 void toIDL(asdmIDL::FlagCmdTableIDL& x) const;
00268
00269 #endif
00270
00271 #ifndef WITHOUT_ACS
00272
00278 void fromIDL(asdmIDL::FlagCmdTableIDL x) ;
00279 #endif
00280
00281
00282
00283
00284
00289 FlagCmdRow *newRow();
00290
00291
00311 FlagCmdRow *newRow(ArrayTimeInterval timeInterval, string type, string reason, int level, int severity, bool applied, string command);
00312
00313
00314
00327 FlagCmdRow *newRow(FlagCmdRow *row);
00328
00329
00330
00331
00332
00333
00350 FlagCmdRow* add(FlagCmdRow* x) ;
00351
00352
00353
00354
00355
00356
00357
00358
00359
00365 std::vector<FlagCmdRow *> get() ;
00366
00373 const std::vector<FlagCmdRow *>& get() const ;
00374
00375
00386 std::vector <FlagCmdRow*> *getByContext();
00387
00388
00389
00390
00391
00401 FlagCmdRow* getRowByKey(ArrayTimeInterval timeInterval);
00402
00403
00404
00405
00406
00428 FlagCmdRow* lookup(ArrayTimeInterval timeInterval, string type, string reason, int level, int severity, bool applied, string command);
00429
00430
00431 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00432 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00433
00434 private:
00435
00444 FlagCmdTable (ASDM & container);
00445
00446 ASDM & container;
00447
00448 bool archiveAsBin;
00449 bool fileAsBin ;
00450
00451 std::string version ;
00452
00453 Entity entity;
00454
00455
00456
00464 FlagCmdRow* checkAndAdd(FlagCmdRow* x, bool skipCheckUniqueness=false) ;
00465
00471 void append(FlagCmdRow* x) ;
00472
00478 void addWithoutCheckingUnique(FlagCmdRow* x) ;
00479
00480
00481
00482
00483
00484
00492 FlagCmdRow * insertByStartTime(FlagCmdRow* x, std::vector<FlagCmdRow* >& row);
00493
00494
00495
00496
00497
00498
00499 std::vector<FlagCmdRow * > privateRows;
00500
00501
00502
00503
00504
00505
00506
00507
00508 std::vector <FlagCmdRow *> row;
00509
00510
00511
00512
00513
00514
00515 void error() ;
00516
00517
00524 void fromXML(std::string& xmlDoc) ;
00525
00526 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00527
00532 void setFromMIMEFile(const std::string& directory);
00533
00534
00535
00536 void setFromXMLFile(const std::string& directory);
00537
00545 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00546
00547
00554 void setFromMIME(const std::string & mimeMsg);
00555
00559 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00560
00570 void toFile(std::string directory);
00571
00575 bool loadInProgress;
00576 void checkPresenceInMemory() {
00577 if (!presentInMemory && !loadInProgress) {
00578 loadInProgress = true;
00579 setFromFile(getContainer().getDirectory());
00580 presentInMemory = true;
00581 loadInProgress = false;
00582 }
00583 }
00592 void setFromFile(const std::string& directory);
00593
00594 };
00595
00596 }
00597
00598 #endif