00001 #include <archiving/ArchRawScanResult.h>
00002 #include "Sct/IS/IOManagerIS.h"
00003 #include "SctData/ConfigurationVariable.h"
00004 #include "SctData/RawScanResult.h"
00005 #include <iostream>
00006 #include <sstream>
00007 #include <boost/shared_ptr.hpp>
00008
00009 using namespace SctData;
00010 using namespace Sct;
00011 using namespace Sct::IS;
00012 using namespace std;
00013 using namespace boost;
00014
00015 int Help() {
00016 cout << "Takes 4 arguments: run number, scan number, module name, scan type number" << endl << "Optional 5th argument is the cycle number" << endl;
00017 return 0;
00018 }
00019
00020 int main(int argc, char** argv) {
00021 if (argc < 5) return Help();
00022
00023 unsigned int runNumber = 0;
00024 unsigned int scanNumber = 0;
00025 string moduleName = argv[3];
00026 unsigned int typeNumber = 0;
00027 unsigned int cycle = 0;
00028
00029 string arg1 = argv[1];
00030 string arg2 = argv[2];
00031 string arg4 = argv[4];
00032
00033 istringstream istr1(arg1);
00034 istr1 >> runNumber;
00035
00036 istringstream istr2(arg2);
00037 istr2 >> scanNumber;
00038
00039 istringstream istr4(arg4);
00040 istr4 >> typeNumber;
00041
00042 if (argc > 5) {
00043 string arg5 = argv[5];
00044 istringstream istr5(arg5);
00045 istr5 >> cycle;
00046 }
00047
00048 shared_ptr<ConfigurationVariable> variable = ConfigurationVariableIOHelper::getFromTypeRep(typeNumber);
00049
00050 cout << "Try and get raw data for: Run " << runNumber << " Scan: " << scanNumber << " Name: " << moduleName << " Type: " << typeNumber << " Cycle: " << cycle << endl;
00051 ArchRawScanResult ar;
00052 ar.SetUNIXDir();
00053 RawScanResult* raw = ar.CreateRawScanResult(runNumber, scanNumber, moduleName, *variable, cycle);
00054
00055 IOManagerIS::instance().write(*raw);
00056
00057 cout << "Done" << endl;
00058 }