00001
00002
00003
00004
00005
00009
00010
00011 #ifndef lgrEditorDriver_H_
00012 #define lgrEditorDriver_H_
00013
00014 #include "lgrDriver.h"
00015 #include "lgrExportType.h"
00016 #include "filePosition.h"
00017 #include <map>
00018
00019 class DtThread;
00020 class DtRunnable;
00021
00022 namespace MAKLogger
00023 {
00024 class DtLgrEditorCommandFactory;
00025 class DtLgrEditorInterface;
00026 class DtLgrEditorThread;
00027 class DtLgrFileInput;
00028 class DtLgrFileOutput;
00029 class DtLgrPacketPrinter;
00030 class DtLgrPacketPrinterOutput;
00031 class DtLgrPlaybackDriver;
00032 class DtLgrRecordDriver;
00033 class DtMessageInput;
00034 class DtMessageOutput;
00035 class DtMessageState;
00036 class DtLgrSystemDriver;
00037
00040 class DT_DLL_LGRCORE DtLgrEditorDriver : public DtLgrCommandHandler
00041 {
00042 public:
00043
00044 typedef DtLgrEditorCommandFactory Factory;
00045 typedef DtLgrEditorInterface Interface;
00046
00047 typedef std::map<DtString,DtLgrExportType> ExportTypeMap;
00048
00049 DT_VIRTUAL_CTR(DtLgrEditorDriver,(DtLgrSystemDriver&))
00050
00051 virtual ~DtLgrEditorDriver();
00052
00054 virtual void tick();
00055
00056 virtual bool releasePipeline();
00057 virtual bool getPipeline();
00058 virtual bool hasPipeline() const;
00059
00061 virtual DtResponse addExportType(const DtCommand& command);
00062
00064 virtual DtResponse exportFile(const DtCommand& command);
00065
00067 virtual DtResponse exportSection(const DtCommand& command);
00068
00070 virtual DtResponse clearSection(const DtCommand& command);
00071
00073 virtual DtResponse cutSection( const DtCommand& command);
00074
00076 virtual DtResponse mergeInFile( const DtCommand& command);
00077
00079 virtual DtResponse appendFileToEnd( const DtCommand& command);
00080
00082 virtual DtResponse prefixFileToStart( const DtCommand& command);
00083
00085 virtual DtResponse trimStart( const DtCommand& command);
00086
00088 virtual DtResponse offsetTime( const DtCommand& command);
00089
00091 virtual DtResponse convertFile( const DtCommand& command);
00092
00094 virtual DtResponse finishThread( const DtCommand& command);
00095
00097 const ExportTypeMap& exportTypes() const;
00098
00099 public:
00100
00101 static const DtString& exportLoggerFileType();
00102
00103 static const DtString& exportMultipleFileType();
00104
00105 protected:
00106
00108 virtual void finishEditOperation();
00109
00111 void convertOperation();
00112
00114 void exportOperation( const DtString& fileFormat,
00115 const DtString& filename, const DtAbsoluteTime& startTime,
00116 const DtAbsoluteTime& endTime, const DtRelativeTime& offset,
00117 bool checkpoint, bool openAfterExport, bool silentSpawnThread);
00118
00124 void mergeOperation( const DtString& filename,
00125 const DtRelativeTime& offset);
00126
00128 void offsetOperation(const DtRelativeTime& offset);
00129
00132 void completeFileOperation( bool success,DtString outputName,
00133 bool selectAll);
00134
00137 virtual void exportToFile(const DtString& fileExportType, const DtString& filename,
00138 DtAbsoluteTime startTime, DtAbsoluteTime endTime, DtRelativeTime offset,
00139 bool checkpoint, bool openAfterExport, bool silentSpawnThread);
00140
00143 void exportToMultipleFiles(const DtString& destination, DtAbsoluteTime startTime,
00144 DtAbsoluteTime endTime, DtRelativeTime offset, bool checkpoint,
00145 bool openAfterExport, bool silentSpawnThread);
00146
00149 virtual void exportToPrinter(const DtString& exportType,
00150 DtLgrPacketPrinter* printer, const DtString& destination,
00151 DtAbsoluteTime startTime, DtAbsoluteTime endTime,
00152 DtRelativeTime offset, bool generateData, bool silentSpawnThread);
00153
00155 virtual void clearSectionOperation(const DtAbsoluteTime& start,
00156 const DtAbsoluteTime& end);
00157
00159 virtual void cutSectionOperation(const DtAbsoluteTime& start,
00160 const DtAbsoluteTime& end);
00161
00167 virtual bool preparePlaybackFileAndPrinter(DtLgrFileInput** fileInput,
00168 DtLgrPacketPrinterOutput** printerOutput, DtLgrPacketPrinter* printer,
00169 const DtString& destination);
00170
00176 bool prepareRecordFileAndPrinter(DtLgrFileInput** fileInput,
00177 DtLgrPacketPrinterOutput** printerOutput, DtLgrPacketPrinter* printer,
00178 const DtString& printerDestination,DtFilePosition firstPacket,
00179 DtFilePosition lastPacket);
00180
00187 virtual bool preparePlaybackFileForEditing(DtLgrFileInput** fileInput,
00188 DtLgrFileOutput** fileOutput);
00189
00196 virtual bool prepareRecordFileForEditing( DtLgrFileInput** fileInput,
00197 DtLgrFileOutput** fileOutput, const DtString& filename,
00198 DtFilePosition firstPacekt,DtFilePosition lastPacket);
00199
00201 virtual bool prepareFileForInput(const DtLgrFileInput* existingInput,
00202 DtLgrFileInput** secondaryInput, const DtString& filename );
00203
00208 virtual DtLgrPlaybackDriver* getPlaybackDriver(bool checkForFileOpen) const;
00209
00212 virtual DtLgrRecordDriver* getRecordDriver() const;
00213
00214
00215 protected:
00216
00218 DtLgrSystemDriver& mySystemDriver;
00219
00221 typedef std::map<DtString,DtLgrPacketPrinter*> PacketPrinterMap;
00222
00224 PacketPrinterMap myExportPrinters;
00225
00227 ExportTypeMap myExportTypes;
00228
00231 int myPacketOperationCount;
00232
00234 DtString myCurrentOperationName;
00235
00238 bool myDeleteSecondaryInputFlag;
00239
00240 protected:
00243 static DtLgrExportType theExportLoggerFileType;
00244
00247 static DtLgrExportType theExportMultipleFileType;
00248
00249 };
00250
00251 }
00252
00253 #endif