#include <RotoClientBinaryFile.h>
Inheritance diagram for RotoClientBinaryFile:

Public Member Functions | |
| RotoClientBinaryFile (const Char_t *ipaddress, Int_t port, MinosRooterEntity whom=MINOS_ROOTER_DCP) | |
| ~RotoClientBinaryFile () | |
| virtual Bool_t | Connected () |
| virtual Bool_t | SendRecordBuffer (const void *buffer, Int_t nbytes) |
| virtual Bool_t | OpenDAQFile (Int_t detector, Int_t run, Int_t subrun) |
| virtual Bool_t | OpenDCSFile (Int_t detector, Int_t sec, Int_t nanosec) |
| virtual Bool_t | OpenBeamMonFile (Int_t detector, Int_t sec, Int_t nanosec) |
| virtual Bool_t | CloseDAQFile (Int_t detector, Int_t run, Int_t subrun) |
| virtual Bool_t | CloseDCSFile (Int_t detector, Int_t sec, Int_t nanosec) |
| virtual Bool_t | CloseBeamMonFile (Int_t detector, Int_t sec, Int_t nanosec) |
| virtual Bool_t | GetRotoStatus (Char_t *statusBuffer, Int_t maxBytes) |
| virtual Bool_t | SendShutdownMessage () |
Protected Member Functions | |
| string | BuildDAQFileName (Int_t detector, Int_t run, Int_t subrun) |
| string | BuildDCSFileName (Int_t detector, Int_t sec, Int_t nanosec) |
| string | BuildBeamMonFileName (Int_t detector, Int_t sec, Int_t nanosec) |
| virtual Bool_t | OpenFile (const string &fname) |
| virtual Bool_t | CloseFile (const string &fname) |
Private Attributes | |
| string | fFileName |
| FILE * | fFile |
|
||||||||||||||||
|
Definition at line 23 of file RotoClientBinaryFile.cxx. 00025 : RotoClient(ipaddress,port,whom), fFileName(""), 00026 #ifdef BINARYVIAOSTREAM 00027 fStream(0) 00028 #else 00029 fFile(0) 00030 #endif 00031 { 00032 // use ipaddress (host) as filename 00033 }
|
|
|
Definition at line 36 of file RotoClientBinaryFile.cxx. References fFile. 00037 {
00038 #ifdef BINARYVIAOSTREAM
00039 if (fStream) {
00040 fStream->close();
00041 delete fStream;
00042 fStream = 0;
00043 }
00044 #else
00045 if (fFile) {
00046 fclose(fFile);
00047 delete fFile;
00048 fFile = 0;
00049 }
00050 #endif
00051
00052 }
|
|
||||||||||||||||
|
Definition at line 127 of file RotoClientBinaryFile.cxx. References Detector::AsString(), det, and Form(). Referenced by CloseBeamMonFile(), and OpenBeamMonFile(). 00129 {
00130 Detector::Detector_t det = (Detector::Detector_t)(detector);
00131 Char_t detchar = Detector::AsString(det)[0];
00132 return string(Form("%c%8.8x_%8.8x.mbeam.dat",detchar,sec,nanosec));
00133 }
|
|
||||||||||||||||
|
Definition at line 98 of file RotoClientBinaryFile.cxx. References Detector::AsString(), det, Form(), and run(). Referenced by CloseDAQFile(), and OpenDAQFile(). 00100 {
00101 // don't build the filename
00102
00103 // MSG("Roto",Msg::kInfo)
00104 // << "RotoClientBinaryFile::BuildDAQFileName \""
00105 // << fIPAddress << "\"" << endl;
00106 return fIPAddress;
00107
00108 Detector::Detector_t det = (Detector::Detector_t)(detector);
00109 Char_t detchar = Detector::AsString(det)[0];
00110 // MSG("Roto",Msg::kInfo)
00111 // << "DAQfile detector(" << detector
00112 // << ") run(" << run << ") subrun (" << subrun << ") -> " << endl
00113 // << Form("%c%8.8d_%4.4d.mdaq.dat",detchar,run,subrun) << endl;
00114 return string(Form("%c%8.8d_%4.4d.mdaq.dat",detchar,run,subrun));
00115 }
|
|
||||||||||||||||
|
Definition at line 118 of file RotoClientBinaryFile.cxx. References Detector::AsString(), det, and Form(). Referenced by CloseDCSFile(), and OpenDCSFile(). 00120 {
00121 Detector::Detector_t det = (Detector::Detector_t)(detector);
00122 Char_t detchar = Detector::AsString(det)[0];
00123 return string(Form("%c%8.8x_%8.8x.mdcs.dat",detchar,sec,nanosec));
00124 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 91 of file RotoClientBinaryFile.cxx. References BuildBeamMonFileName(), and CloseFile(). 00093 {
00094 return CloseFile(BuildBeamMonFileName(detector,sec,nanosec));
00095 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 67 of file RotoClientBinaryFile.cxx. References BuildDAQFileName(), CloseFile(), and run(). 00069 {
00070 return CloseFile(BuildDAQFileName(detector,run,subrun));
00071 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 79 of file RotoClientBinaryFile.cxx. References BuildDCSFileName(), and CloseFile(). 00081 {
00082 return CloseFile(BuildDCSFileName(detector,sec,nanosec));
00083 }
|
|
|
Reimplemented from RotoClient. Definition at line 158 of file RotoClientBinaryFile.cxx. References fFile, fFileName, and MSG. Referenced by CloseBeamMonFile(), CloseDAQFile(), CloseDCSFile(), OpenFile(), and SendShutdownMessage(). 00159 {
00160
00161 if (fname == fFileName) {
00162 if (fFileName != "") {
00163 #ifdef BINARYVIAOSTREAM
00164 if (fStream) {
00165 MSG("Roto",Msg::kInfo) << "CloseFile \"" << fFileName <<"\""<< endl;
00166 fStream->close();
00167 delete fStream;
00168 fStream = 0;
00169 }
00170 #else
00171 if (fFile) {
00172 MSG("Roto",Msg::kInfo) << "CloseFile \"" << fFileName <<"\""<< endl;
00173 fclose(fFile);
00174 fFile = 0;
00175 }
00176 #endif
00177 fFileName = "";
00178 }
00179 return true;
00180 } else {
00181 MSG("Roto",Msg::kWarning)
00182 << "RotoClientBinaryFile::CloseFile name mismatch" << endl
00183 << fFileName << " is open" << endl
00184 << fname << " was requested to be closed " << endl;
00185 return false;
00186 }
00187 }
|
|
|
Reimplemented from RotoClient. Definition at line 55 of file RotoClientBinaryFile.cxx. 00056 {
00057 return true;
00058 }
|
|
||||||||||||
|
Reimplemented from RotoClient. Definition at line 190 of file RotoClientBinaryFile.cxx. 00191 {
00192 snprintf(statusBuffer,maxBytes,"RotoClientBinaryFile:: status");
00193 return true;
00194 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 85 of file RotoClientBinaryFile.cxx. References BuildBeamMonFileName(), and OpenFile(). 00087 {
00088 return OpenFile(BuildBeamMonFileName(detector,sec,nanosec));
00089 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 61 of file RotoClientBinaryFile.cxx. References BuildDAQFileName(), OpenFile(), and run(). 00063 {
00064 return OpenFile(BuildDAQFileName(detector,run,subrun));
00065 }
|
|
||||||||||||||||
|
Reimplemented from RotoClient. Definition at line 73 of file RotoClientBinaryFile.cxx. References BuildDCSFileName(), and OpenFile(). 00075 {
00076 return OpenFile(BuildDCSFileName(detector,sec,nanosec));
00077 }
|
|
|
Reimplemented from RotoClient. Definition at line 136 of file RotoClientBinaryFile.cxx. References CloseFile(), fFile, fFileName, and MSG. Referenced by OpenBeamMonFile(), OpenDAQFile(), and OpenDCSFile(). 00137 {
00138 if (fFileName != "") {
00139 MSG("Roto",Msg::kWarning)
00140 << "RotoClientBinaryFile::OpenFile called while "
00141 << fFileName << " was still open" << endl;
00142 CloseFile(fFileName);
00143 }
00144
00145 fFileName = fname;
00146 #ifdef BINARYVIAOSTREAM
00147 fStream = new ofstream(fname.c_str(),ios::out|ios::binary|ios::trunc);
00148 #else
00149 fFile = fopen(fname.c_str(),"wb");
00150 #endif
00151
00152 MSG("Roto",Msg::kInfo) << "OpenFile \"" << fFileName << "\"" << endl;
00153
00154 return true;
00155 }
|
|
||||||||||||
|
Reimplemented from RotoClient. Definition at line 197 of file RotoClientBinaryFile.cxx. 00198 {
00199 MSG("Roto",Msg::kVerbose)
00200 << "RotoClientBinaryFile::SendRecordBuffer" << endl;
00201
00202 #ifdef BINARYVIAOSTREAM
00203 if (!fStream) {
00204 #else
00205 if (!fFile) {
00206 #endif
00207 MSG("Roto",Msg::kWarning)
00208 << "RotoClientBinaryFile::SendRecordBuffer - no open file" << endl;
00209 return false;
00210 }
00211
00212 // in binary mode one can NOT use operator<<
00213
00214 // output the number of bytes inclusive of the byte count
00215 Int_t nrecbytes = nbytes + sizeof(Int_t);
00216 Int_t* nrb_addr = &nrecbytes;
00217 #ifdef BINARYVIAOSTREAM
00218 fStream->write((const char*)nrb_addr,sizeof(Int_t));
00219
00220 // output the buffer
00221 fStream->write((const char*)buffer,nbytes);
00222
00223 fStream->flush();
00224 #else
00225 fwrite(nrb_addr,sizeof(Int_t),1,fFile);
00226 fwrite(buffer,1,nbytes,fFile);
00227 fflush(fFile);
00228 #endif
00229
00230 return true;
00231 }
|
|
|
Reimplemented from RotoClient. Definition at line 234 of file RotoClientBinaryFile.cxx. References CloseFile(), fFileName, and MSG. 00235 {
00236
00237 MSG("Roto",Msg::kInfo)
00238 << "RotoClientBinaryFile::SendShutdownMessage" << endl;
00239
00240 CloseFile(fFileName);
00241 return true;
00242 }
|
|
|
Definition at line 58 of file RotoClientBinaryFile.h. Referenced by CloseFile(), OpenFile(), SendRecordBuffer(), and ~RotoClientBinaryFile(). |
|
|
Definition at line 54 of file RotoClientBinaryFile.h. Referenced by CloseFile(), OpenFile(), and SendShutdownMessage(). |
1.3.9.1