00001
00002
00003
00004
00006 #ifndef IOINPUTMODULE_H
00007 #define IOINPUTMODULE_H
00008 #include "TStopwatch.h"
00009
00010 #ifndef MAP
00011 #include <map>
00012 #define MAP
00013 #endif
00014 #ifndef STRING
00015 #include <string>
00016 #define STRING
00017 #endif
00018 #ifndef LIST
00019 #include <list>
00020 #define LIST
00021 #endif
00022 using namespace std;
00023
00024 #include "JobControl/JobCInputModule.h"
00025 #include "Dispatcher/DDS.h"
00026
00027 #ifndef IOFILELISTITEM_H
00028 #include "IoModules/IoFileListItem.h"
00029 #endif
00030 #ifndef PER_H
00031 #include "Persistency/Per.h"
00032 #endif
00033 #ifdef SITE_HAS_SAM
00034 #include "sam_cpp_api/SamProject.hpp"
00035 #endif
00036
00037 class IoDataStreamItr;
00038 class Registry;
00039 class VldContext;
00040 class MomNavigator;
00041
00042 class IoInputModule : public JobCInputModule {
00043
00044 public:
00045 IoInputModule();
00046 ~IoInputModule();
00047
00048
00049 void BeginJob();
00050 void EndJob();
00051 const Registry& DefaultConfig() const;
00052 void Config(const Registry& r);
00053
00054
00055 JobCResult Get();
00056
00057 JobCResult Next(int n=1);
00058 JobCResult Prev(int n=1);
00059 JobCResult GoTo(int run, int snarl, int searchDir=0);
00060 JobCResult GoTo(const VldContext& vld);
00061
00062 void List(const char* streamlist = "*") const;
00063 void AddFile(const char *filename, const char* streamlist = "*",int at = -1);
00064 void RemoveFile(const char* filename, const char* streamlist = "*");
00065
00066 JobCResult NextFile(int n=1, const char* streamlist = "*");
00067 JobCResult PrevFile(int n=1, const char* streamlist = "*");
00068 JobCResult GoToFile(int i, const char* streamlist = "*");
00069 JobCResult GoToFile(const char* filename, const char* streamlist = "*");
00070
00071 void DefineStream(const char* stream, const char* tree);
00072 void Select(const char* stream, const char* select, bool isRequired = false);
00073 void SetSequenceMode(const char* stream,
00074 Per::ESequenceMode sequenceMode = Per::kKey);
00075 void SetPerOwnedDisabled(const char* stream,
00076 bool perowneddisabled = true);
00077 void SetTestMode(const char* stream,
00078 bool testMode);
00079 void SetWindow(const char* stream, double lower, double upper);
00080
00081 void SetMaxFileRepeat(const char* stream,int numRepeat);
00082 void SetMeanMom(const char* stream, double mean);
00083 void SetPushRandom(const char* stream, bool setRandom);
00084 void SetRandomSeed(int rSeed);
00085
00086
00087 Int_t GetCurrentRun() const { return fCurrentRun; };
00088 Int_t GetLastRun() const { return fLastRun; };
00089 const char* GetCurrentFile(const char* streamname = "*") const;
00090 const char* GetLastFile(const char* streamname = "*") const;
00091 Int_t GetCurrentSnarl() const { return fCurrentSnarl; };
00092
00093 private:
00094
00095 void LoadFilesFromCommandLine();
00096 int ReadHeader();
00097 void UpdateDDSConfig();
00098 void UpdateFormatConfig();
00099 void UpdateFileList();
00100 void UpdateStreamConfig();
00101 int OpenStreamItr();
00102 void CloseStreamItr();
00103
00104
00105 JobCResult Get(MomNavigator*) { return JobCResult::kAOK; }
00106
00107 private:
00108 std::map<std::string,std::string> fStreamSelectionMap;
00109 std::map<std::string,bool> fStreamRequiredMap;
00110 std::map<std::string,std::string> fStreamDefMap;
00111 std::map<std::string,Per::ESequenceMode> fStreamSeqModeMap;
00112 std::map<std::string,bool> fStreamPerOwnedDisabledMap;
00113 std::map<std::string,bool> fStreamTestModeMap;
00114 std::map<std::string,std::pair<double,double> > fStreamWindowMap;
00115
00116 std::list<IoFileListItem> fFileList;
00117 IoDataStreamItr* fDataStreamItr;
00118
00119 std::string fFormat;
00120 std::string fStreamList;
00121
00122 std::map<std::string,int> fStreamMaxRepeatMap;
00123 std::map<std::string,double> fStreamMeanMap;
00124 std::map<std::string,bool> fStreamPushRandomMap;
00125 int fRandomSeed;
00126
00127
00128 std::string fServer;
00129 int fPort;
00130 int fTimeOut;
00131 int fDataSource;
00132 int fKeepUpMode;
00133 int fMaxSyncDelay;
00134 bool fOffLine;
00135 int fMaxRetry;
00136 int fRetryDelay;
00137 DDS::EClientType fClientType;
00138 string fClientName;
00139
00140
00141 JobCResult fStatus;
00142 int fLastRun;
00143 int fLastSnarl;
00144 int fCurrentRun;
00145 int fCurrentSnarl;
00146 std::map<std::string,std::string> fCurrentFileMap;
00147 std::map<std::string,std::string> fLastFileMap;
00148 std::string fLastBeginFile;
00149 std::string fLastEndFile;
00150 bool fLoadedCommandLineFiles;
00151 TStopwatch fStopwatch;
00152
00153 #ifdef SITE_HAS_SAM
00154
00155
00156
00157 std::string fStation;
00158 int fSnapShotVers;
00159 std::string fWorkGroupName;
00160 std::string fApplicationName;
00161 std::string fApplicationVers;
00162 std::string fProjectName;
00163 int fMaxNumberOfFiles;
00164 int fStartNewProject;
00165 sam::SamProject* fsamProject;
00166 #endif
00167
00168 };
00169
00170 #endif // IOINPUTMODULE_H
00171
00172