Go to the documentation of this file.00001
00002
00003
00004
00005
00008
00009 #ifndef lgrPacketIndexer_H_
00010 #define lgrPacketIndexer_H_
00011
00012 #include "lgrCore.h"
00013 #include "filePosition.h"
00014
00015 #include <vector>
00016 #include <vlutil/vlNetTypes.h>
00017
00018 namespace MAKLogger
00019 {
00020 class DtPacket;
00021
00024 class DT_DLL_LGRCORE DtLgrPacketIndexer
00025 {
00026 public:
00028 DtLgrPacketIndexer();
00029
00031 ~DtLgrPacketIndexer();
00032
00033 private:
00035 DtLgrPacketIndexer(const DtLgrPacketIndexer&);
00037 DtLgrPacketIndexer& operator=(const DtLgrPacketIndexer&);
00038 public:
00039
00042 int addEntry(double time,DtFilePosition position,int size);
00043
00046 void removeEntry(int index);
00047
00049 void clearEntries();
00050
00053 int firstIndex();
00054
00057 int lastIndex();
00058
00060 int indexCount() const;
00061
00064 int getIndexAtOrBeforeTime(double time);
00065
00068 int getIndexAtOrAfterTime(double time);
00069
00072 DtFilePosition getPositionOfIndex(int index);
00073
00076 double getTimeOfIndex(int index);
00077
00080 int getSizeOfIndex(int index);
00081
00083 DtPacket* encodePacket() const;
00084
00089 void decodePacket(const DtPacket* packet);
00090
00091 protected:
00092
00093 struct IndexEntry
00094 {
00095 double time;
00096 DtFilePosition filePosition;
00097 DtU32 packetSize;
00098 };
00099
00101 struct NetIndexEntry
00102 {
00103 DtNetFloat64 time;
00104 DtNetU64 filePosition;
00105 DtNetU32 packetSize;
00106 };
00107
00110 struct NetIndexTable
00111 {
00112 DtNetU32 numEntries;
00113 DtNetU32 unused;
00114 };
00115
00116 typedef std::vector<IndexEntry> CheckpointEntryList;
00117 CheckpointEntryList myCheckpointEntries;
00118 };
00119 }
00120
00121 #endif