My Project
|
00001 #ifndef ACQUIRENEUTRONSOURCETEXTINFORMATION 00002 #define ACQUIRENEUTRONSOURCETEXTINFORMATION 00003 00004 #define HOST_NAME "www-cont.j-parc.jp" 00005 //#define HOST_PROTCOL http 00006 //#define HOST_PORT 80 00007 //#define USER_AGENT "target Information API/1.00" 00008 00009 /* cgi path of signal keys */ 00010 #define H2_ENTRANCE_PATH "/MLF/cgi/H2TempRead.pl" 00011 #define H2_COUPLED_PATH "/MLF/cgi/H2TempRead.pl" 00012 #define H2_DECOUPLED_PATH "/MLF/cgi/H2TempRead.pl" 00013 #define H2_POISON_PATH "/MLF/cgi/H2TempRead.pl" 00014 #define CT_MUON_TARGET_PATH "/MLF/cgi/CTdataRead6.2.pl" 00015 #define CT_NEUTRON_TARGET_PATH "/MLF/cgi/CTdataRead6.2.pl" 00016 #define BEAM_STOP_START_PATH "/MLF/cgi/CTdataRead8.2.pl" 00017 00018 /* time step key word*/ 00019 #define TIME_KEY_SHOT "shot" 00020 #define TIME_KEY_SECOND "second" 00021 #define TIME_KEY_10SECOND "10second" 00022 #define TIME_KEY_MIN "min" 00023 #define TIME_KEY_HOUR "hour" 00024 #define TIME_KEY_DAY "day" 00025 #define TIME_KEY_MONTH "month" 00026 #define TIME_KEY_SUM "sum" 00027 #define TIME_KEY_01MIN "1Min" 00028 #define TIME_KEY_05MIN "5Min" 00029 #define TIME_KEY_10MIN "10Min" 00030 #define TIME_KEY_15MIN "15Min" 00031 #define TIME_KEY_30MIN "30Min" 00032 #define TIME_KEY_60MIN "60Min" 00033 00034 /* time at second */ 00035 #define TIME_01 1 00036 #define TIME_05 5 00037 #define TIME_10 10 00038 #define TIME_15 15 00039 #define TIME_30 30 00040 #define TIME_60 60 00041 #define TIME_HOUR 3600 00042 #define TIME_DAY 86400 00043 #define TIME_MONTH 2592000 00044 00045 #define ERR_VAL -1.0e+0 /* Error return value */ 00046 00047 //#include <iostream> /* for cout */ 00048 //#include <sstream> /* for ostringstream */ 00049 //#include <fstream> /* for ofstream */ 00050 //#include <iomanip> /* manipulator */ 00051 #include <map> /* maultimap */ 00052 #include "AcquireNeutronSourceInformationControlBase.hh" 00054 class AcquireNeutronSourceTextInformation 00055 : public AcquireNeutronSourceInformationControlBase 00056 { 00057 private: 00058 ostringstream format1; /* POST command */ 00059 ostringstream format2; /* host command */ 00060 ostringstream format3; /* content-length */ 00061 ostringstream format4; /* data */ 00062 string request; /* send request message */ 00063 00064 //time_t StartDateTime; /* Start day and time */ 00065 00066 Bool DebugFlag; /* Debug mode OFF = false or 0; ON = true or non zero */ 00067 // UInt2 Port; /* The port number to connect */ 00068 00069 string lastDataDate; /* latest date and time with data. */ 00070 00071 protected: 00072 vector<string> DateAtBin; /* List of date at bin span */ 00073 vector<string> TimeAtBin; /* List of time at bin span */ 00074 vector<Double> InfomationValue; /* List of information value */ 00075 00076 vector< pair<string,string> > BeamOffOn; /* List of beam off or on status */ 00077 00078 public: 00079 AcquireNeutronSourceTextInformation(); 00081 00083 AcquireNeutronSourceTextInformation( string host_name, Bool debug_flag = false ); 00085 00090 AcquireNeutronSourceTextInformation( Bool debug_flag ); 00092 00096 virtual ~AcquireNeutronSourceTextInformation(); 00098 00101 string PutCgiPath( const string Key ); 00102 string PutStepKey( const string Key, const Int4 StepTime ); 00103 Int4 SetRequestMessage( const string Key, const string Start, const string End, const string StepKey ); 00104 00105 UInt4 SplitValueData(const string& body_data, string& info_data); 00106 //UInt4 SplitValueData(const string date, const string& body_data, string& info_data); 00107 UInt4 SplitBeamOffData(const string& body_data, string& info_data); 00108 void ReplaceStr( string& str, const string& from, const string& to ); 00109 vector<Double> PutValueData( const string Key, const string Start, const string StepKey, const Int4 bin_step, const string data ); 00110 00111 Double PutValueInformation( const string Key ); 00112 Double PutValueInformation( const string Key, const string Start ); 00113 vector<Double> PutValueInformation( const string Key, const string Start, const string End, const Int4 StepTime = 0 ); 00114 vector<string> PutDateBinInformation(); 00115 vector<string> PutTimeBinInformation(); 00116 00117 void GetTextInformation( const string Key ); 00118 void GetTextInformation( const string Key, const string Start ); 00119 void GetTextInformation( const string Key, const string Start, const string End, const Int4 StepTime=TIME_10 ); 00120 vector<string> PutTextFirstInformation(); 00121 vector<string> PutTextSecondInformation(); 00122 //vector< pair<string,string> > PutTextInformation( const string Key ); 00123 //vector< pair<string,string> > PutTextInformation( const string Key, const string Start ); 00124 //vector< pair<string,string> > PutTextInformation( const string Key, const string Start, const string End, const Int4 StepTime=TIME_10 ); 00125 00126 //vector<Double> ConvertProtonToCurrent(vector<Double> proton); 00127 //vector<Double> ConvertProtonToBeampower(vector<Double> proton); 00128 vector<Double> ConvertProtonToCurrent(vector<Double> proton, const Int4 bin); 00129 vector<Double> ConvertCurrentToBeampower(vector<Double> Current); 00130 }; 00131 00132 #endif