ICP  1
CRPTProxy.h
Go to the documentation of this file.
1 #ifndef CRPT_PROXY
2 #define CRPT_PROXY
3 
4 #include "isiscrpt.h"
5 
6 class ISISCRPT_DATA : public ISIS::Base
7 {
8 private:
15  std::string m_crpt_data_file;
16  std::string m_crpt_data_name;
17 
18 public:
19  ISISCRPT_DATA() : Base("ISISCRPT_DATA"), m_crpt_data(NULL), m_crpt_data_size(0), m_spec_integrals(NULL),
20  m_spec_integrals_size(0), m_crpt_data_fh(INVALID_HANDLE_VALUE), m_crpt_data_fm(NULL) { }
21  void init()
22  {
25  m_crpt_data_fm = NULL;
26  m_crpt_data_fh = INVALID_HANDLE_VALUE;
27  }
28  inline void zeroSpectrum(int spec, int /*daq_period*/)
29  {
30  if (spec >= 0 && spec < m_spec_integrals_size)
31  {
32  m_spec_integrals[spec] = 0;
33  }
34  }
35  inline void incrementSpectrum(int spec, int /*daq_period*/)
36  {
37  if (spec >= 0 && spec < m_spec_integrals_size)
38  {
39  InterlockedIncrement(reinterpret_cast<LONG*>(&(m_spec_integrals[spec])));
40  }
41  }
42 
43  void copy(const ISISCRPT_DATA& clone)
44  {
45  if (this != &clone)
46  {
47  memcpy(m_crpt_data, clone.m_crpt_data, m_crpt_data_size * sizeof(isisU32_t));
49  }
50  }
53  std::string fileName() const { return m_crpt_data_file; }
54  std::string sectionName() const { return m_crpt_data_name; }
55  isisU32_t* rawData() { return m_crpt_data; }
56  const isisU32_t* rawData() const { return m_crpt_data; }
58  const isisU32_t* spectrumIntegrals() const { return m_spec_integrals; }
59  void zeroRawData(isisU32_t data_size = 0)
60  {
61  if (data_size == 0)
62  {
63  data_size = m_crpt_data_size;
64  }
65  ZeroMemory(m_crpt_data, data_size * sizeof(isisU32_t));
66  ZeroMemory(m_spec_integrals, m_spec_integrals_size * sizeof(isisU32_t));
67  }
68  bool valid() const { return m_crpt_data != NULL; }
69  int flush()
70  {
71  FlushViewOfFile(m_crpt_data, 0); // only need to do this as all sections together
72  FlushFileBuffers(m_crpt_data_fh);
73  return DAEstatus::Success;
74  }
75  void unload(bool delete_file)
76  {
77  if (valid() && UnmapViewOfFile(rawData()) == 0)
78  {
79  LOGSTR_INFORMATION("Error unmapping data file on exit");
80  }
81  if (m_crpt_data_fm != NULL && CloseHandle(m_crpt_data_fm) == 0)
82  {
83  LOGSTR_INFORMATION("Error closing crpt data mapping file handle on exit");
84  }
85  if (m_crpt_data_fh != INVALID_HANDLE_VALUE && CloseHandle(m_crpt_data_fh) == 0)
86  {
87  LOGSTR_INFORMATION("Error closing crpt data file handle on exit");
88  }
89  if (delete_file)
90  {
91  LOGSTR_INFORMATION("Deleting CRPT data " << m_crpt_data_file.c_str());
92  remove(m_crpt_data_file.c_str());
93  }
94  init();
95  }
96 
97  int loadOrCreate(const char* crpt_data_file, const char* crpt_data_name, int crpt_data_size, DAEstatus& status)
98  {
99  LARGE_INTEGER size;
100  init();
102  m_crpt_data_size = crpt_data_size;
103  m_crpt_data_fh = CreateFile(crpt_data_file, GENERIC_READ | GENERIC_WRITE, 0, defaultNoInheritHandles(), OPEN_ALWAYS,
104  FILE_ATTRIBUTE_NORMAL /* | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING */, NULL);
105  if (m_crpt_data_fh == INVALID_HANDLE_VALUE)
106  {
107  status.addVa(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "CreateFile failed for \"%s\" - WIN32 error code = %d", crpt_data_file, GetLastError());
108  unload(false);
109  return DAEstatus::Failure;
110  }
111  if (GetFileSizeEx(m_crpt_data_fh, &size) == 0)
112  {
113  status.add(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "GetFileSize failed");
114  unload(false);
115  return DAEstatus::Failure;
116  }
117  if ( size.QuadPart != (fileSizeMax() * sizeof(isisU32_t)) )
118  {
119  status.addVa(FAC_CRPT, SEV_WARNING, ERRTYPE_OUTOFMEM, "crpt data size error: %I64d != %Id delete file %s and try again", size.QuadPart, fileSizeMax() * sizeof(isisU32_t), crpt_data_file);
120  CloseHandle(m_crpt_data_fh);
121  remove(crpt_data_file);
122  m_crpt_data_fh = CreateFile(crpt_data_file, GENERIC_READ | GENERIC_WRITE, 0, defaultNoInheritHandles(), CREATE_ALWAYS,
123  FILE_ATTRIBUTE_NORMAL /* | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING */, NULL);
124  size.QuadPart = fileSizeMax() * sizeof(isisU32_t);
125  }
126  status.addInfoVa(FAC_CRPT, "CRPT data \"%s\" size %Id KB", crpt_data_file, size.QuadPart / 1024);
127  m_crpt_data_fm = CreateFileMapping(m_crpt_data_fh, defaultNoInheritHandles(), PAGE_READWRITE, size.HighPart, size.LowPart, crpt_data_name);
128  if (m_crpt_data_fm == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
129  {
130  status.addVa(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "CreateFileMapping failed for \"%s\" - WIN32 error code = %d", crpt_data_file, GetLastError());
131  unload(false);
132  return DAEstatus::Failure;
133  }
134  m_crpt_data = (isisU32_t*)MapViewOfFile(m_crpt_data_fm, FILE_MAP_WRITE, 0, 0, 0);
135  if (m_crpt_data == NULL)
136  {
137  unload(false);
138  status.addVa(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "MapViewOfFile failed for \"%s\" - WIN32 error code = %d", crpt_data_file, GetLastError());
139  return DAEstatus::Failure;
140  }
141  m_crpt_data_file = crpt_data_file;
142  m_crpt_data_name = crpt_data_name;
144  return DAEstatus::Success;
145  }
146 
147  int load(const char* crpt_data_file, HANDLE crpt_data_fh, const char* crpt_data_name, int crpt_data_size, bool read_only, DAEstatus& status)
148  {
149  LARGE_INTEGER size;
150  int file_map_mode = (read_only ? PAGE_READONLY : PAGE_READWRITE);
151  int view_map_mode = (read_only ? FILE_MAP_READ : FILE_MAP_WRITE);
152  init();
154  m_crpt_data_size = crpt_data_size;
155  if (GetFileSizeEx(crpt_data_fh, &size) == 0)
156  {
157  status.add(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "GetFileSize failed");
158  unload(false);
159  return DAEstatus::Failure;
160  }
161  if ( size.QuadPart != (fileSizeMax() * sizeof(isisU32_t)) )
162  {
163  status.addVa(FAC_CRPT, SEV_WARNING, ERRTYPE_OUTOFMEM, "crpt data size error: %I64d != %Id", size.QuadPart, fileSizeMax() * sizeof(isisU32_t));
164  unload(false);
165  return DAEstatus::Failure;
166  }
167  m_crpt_data_fm = CreateFileMapping(crpt_data_fh, defaultNoInheritHandles(), file_map_mode, size.HighPart, size.LowPart, crpt_data_name);
168  if (m_crpt_data_fm == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
169  {
170  status.addVa(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "CreateFileMapping failed - WIN32 error code = %d", GetLastError());
171  unload(false);
172  return DAEstatus::Failure;
173  }
174  m_crpt_data = (isisU32_t*)MapViewOfFile(m_crpt_data_fm, view_map_mode, 0, 0, 0);
175  if (m_crpt_data == NULL)
176  {
177  status.addVa(FAC_CRPT, SEV_ERROR, ERRTYPE_OUTOFMEM, "MapViewOfFile failed - WIN32 error code = %d", GetLastError());
178  unload(false);
179  return DAEstatus::Failure;
180  }
181  m_crpt_data_file = crpt_data_file;
182  m_crpt_data_name = crpt_data_name;
183  m_crpt_data_fh = crpt_data_fh;
185  return DAEstatus::Success;
186  }
187 
188  int map(const std::string& crpt_data_name, bool read_only, bool /*existing*/)
189  {
190  int map_opt = (read_only ? FILE_MAP_READ : FILE_MAP_WRITE);
191  while( (m_crpt_data_fm = OpenFileMapping(map_opt, FALSE, crpt_data_name.c_str())) == NULL )
192  {
193  Sleep(2000);
194  }
195  m_spec_integrals = NULL;
196  m_crpt_data = (isisU32_t*)MapViewOfFile(m_crpt_data_fm, map_opt, 0, 0, 0);
197  if (m_crpt_data == NULL)
198  {
199  LOGSTR_ERROR("error in MapViewOfFile");
200  CloseHandle(m_crpt_data_fm);
201  m_crpt_data_fm = NULL;
202  return DAEstatus::Failure;
203  }
204  std::string fname = fileNameFromMappedView(m_crpt_data);
205  if (fname.size() > 0)
206  {
207  int64_t fsize = fileSizeBytes(fname);
208  if (fsize == 0)
209  {
210  LOGSTR_ERROR(fname << " has zero size - assuming c:\\data\\data.run and trying again");
211  fsize = fileSizeBytes("c:\\data\\data.run");
212  }
213  if (fsize == 0)
214  {
215  LOGSTR_ERROR(fname << "c:\\data\\data.run has zero size - exiting");
216  UnmapViewOfFile(m_crpt_data);
217  m_crpt_data = NULL;
218  CloseHandle(m_crpt_data_fm);
219  m_crpt_data_fm = NULL;
220  return DAEstatus::Failure;
221  }
222  m_crpt_data_size = static_cast<isisU32_t>(fsize / sizeof(isisU32_t));
223  // m_spec_integrals = m_crpt_data + m_crpt_data_size;
224  }
225  else
226  {
227  LOGSTR_ERROR("error in fileNameFromMappedView");
228  UnmapViewOfFile(m_crpt_data);
229  m_crpt_data = NULL;
230  CloseHandle(m_crpt_data_fm);
231  m_crpt_data_fm = NULL;
232  return DAEstatus::Failure;
233  }
234  return DAEstatus::Success;
235  }
236 };
237 
238 class CRPTProxy : public ISIS::Base
239 {
240 public:
241  struct parameter_t
242  {
243  std::string type;
244  std::string value;
245  std::string units;
246  parameter_t(const std::string& t, const std::string& u, const std::string& v) : type(t), units(u), value(v) {}
247  };
248  typedef std::map<std::string, parameter_t> parameter_map_t;
249 private:
250  Poco::Mutex m_crpt_lock;
251  Poco::Mutex m_data_lock;
254 
255  HANDLE m_crpt_fh;
256  HANDLE m_crpt_fm;
258  std::string m_comp_name;
259  std::string m_crpt_file;
260  std::string m_crpt_name;
262 
263  std::string m_status_log;
264  std::string m_event_log;
265  std::string m_debug_log;
266  std::string m_monitoring_log;
267  std::string m_timediff_log;
268 
269  // used for beamline and sample parameters
272 
273  CRPTProxy(const CRPTProxy&) { }
275  {
276  m_crpt = NULL;
277  m_crpt_fm = NULL;
278  m_crpt_fh = INVALID_HANDLE_VALUE;
279  m_crpt_data.init();
280  }
281  int flushSection(void* address, HANDLE file_handle, DAEstatus& status);
282 
283 public:
285  Poco::Mutex& getLockRef() { return m_crpt_lock; }
286  Poco::Mutex& getDataLockRef() { return m_data_lock; }
287  const std::string& statusLog() const { return m_status_log; }
288  const std::string& eventLog() const { return m_event_log; }
289  const std::string& debugLog() const { return m_debug_log; }
290  const std::string& monitoringLog() const { return m_monitoring_log; }
291  const std::string& timeDiffLog() const { return m_timediff_log; }
294  int assignLogFiles(const std::string& prefix);
295  int assignLogFiles(bool use_full_inst_name_for_files, const std::string& data_dir, int run_number_digits);
297  time_t rawDataUpdateTime() const { return m_raw_data_update_time; }
300  std::string dataFileName() const { return m_crpt_data.fileName(); }
301  std::string dataSectionName() const { return m_crpt_data.sectionName(); }
303  {
304  Poco::Mutex::ScopedLock _lock(m_data_lock);
305  return m_crpt_data.rawData();
306  }
307  const isisU32_t* rawData() const
308  {
309  return m_crpt_data.rawData();
310  }
312  {
313  Poco::Mutex::ScopedLock _lock(m_data_lock);
314  return m_crpt_data.spectrumIntegrals();
315  }
317  {
318  return m_crpt_data.spectrumIntegrals();
319  }
321  {
322  return m_crpt_data.fileSizeMax();
323  }
324  void setICPStartTime(time_t t)
325  {
326  m_crpt->icp_start_time = t;
327  }
328  void zeroAllRawData(DAEstatus& status)
329  {
330  Poco::Mutex::ScopedLock _lock(m_data_lock);
331  ICPTimer timer("CRPTProxy::zeroAllRawData", status);
333  rawDataUpdated();
334  }
335  void zeroUsedRawData(DAEstatus& status)
336  {
337  Poco::Mutex::ScopedLock _lock(m_data_lock);
338  ICPTimer timer("CRPTProxy::zeroUsedRawData", status);
339  isisU32_t data_size = rawDataSizeUsed();
340  if (data_size > rawDataSizeMax())
341  {
342  data_size = rawDataSizeMax();
343  }
344  m_crpt_data.zeroRawData(data_size);
345  rawDataUpdated();
346  }
347  void zeroEventRawData(DAEstatus& status);
348  ISISCRPT_STRUCT* CRPT() { return m_crpt; }
349  const ISISCRPT_STRUCT* CRPT() const { return m_crpt; }
350  CRPTProxy();
351  bool isValid() const { return m_crpt != NULL; }
353  const ISISCRPT_STRUCT* operator->() const { return m_crpt; }
354  int flushCRPT(DAEstatus& status, bool flush_raw_data = false);
355  int mapCRPT(const std::string& crpt_name, const std::string& crpt_data_name, bool read_only, bool existing);
356  int loadOrCreateCRPT(const std::string& crpt_file, const std::string& crpt_name,
357  const std::string& crpt_data_file, const std::string& crpt_data_name, int crpt_data_size,
358  ISISDAE::DAEType dae_type, const std::string& comp_name, boost::function<int (DAEstatus&)> readRecoveryFile, DAEstatus& status);
359  int loadOrCreateCRPT(const char* crpt_file, const char* crpt_name,
360  const char* crpt_data_file, const char* crpt_data_name, int crpt_data_size,
361  ISISDAE::DAEType dae_type, const char* comp_name, boost::function<int (DAEstatus&)> readRecoveryFile, DAEstatus& status);
362  int loadCRPT(const char* crpt_file, const char* crpt_name,
363  const char* crpt_data_file, const char* crpt_data_name, int crpt_data_size, bool read_only, DAEstatus& status);
364  int loadCRPT(const char* crpt_file, HANDLE crpt_fh, const char* crpt_name, const char* crpt_data_file,
365  HANDLE crpt_data_fh, const char* crpt_data_name, int crpt_data_size, bool read_only, DAEstatus& status);
366  int unloadCRPT(bool delete_crpt_file, bool delete_crpt_data_file, DAEstatus& status);
367  int unloadCRPT(DAEstatus& status) { return unloadCRPT(false, false, status); }
368  ~CRPTProxy() { DAEstatus status; unloadCRPT(status); }
369 // int clone(const std::string& crpt_file, const std::string& crpt_data_file, bool blank_raw_data, DAEstatus& status);
370  int createFrom(CRPTProxy& proxy_clone, int id, bool blank_raw_data, DAEstatus& status);
371  int updateFrom(CRPTProxy& proxy_clone, bool copy_raw_data, DAEstatus& status);
372 // int copyDataTo(const std::string& filename, DAEstatus& status) const;
373 
374  int getIntArrayItem(const char* item_name, const long* spec_array, int nspec, long* larray, DAEstatus& status) const
375  {
376  return m_crpt->getIntArrayItem(rawData(), rawDataSizeMax(), item_name, spec_array, nspec, larray, status);
377  }
378  int getIntArrayItem(const char* item_name, long* larray, DAEstatus& status) const
379  {
380  return m_crpt->getIntArrayItem(rawData(), rawDataSizeMax(), item_name, larray, status);
381  }
382  int getRealArrayItem(const char* item_name, const long* spec_array, int nspec, double* darray, DAEstatus& status) const
383  {
384  return m_crpt->getRealArrayItem(rawData(), rawDataSizeMax(), item_name, spec_array, nspec, darray, status);
385  }
386  int getRealArrayItem(const char* item_name, const long* spec_array, int nspec, float* farray, DAEstatus& status) const
387  {
388  return m_crpt->getRealArrayItem(rawData(), rawDataSizeMax(), item_name, spec_array, nspec, farray, status);
389  }
390  int getRealArrayItem(const char* item_name, double* darray, DAEstatus& status) const
391  {
392  return m_crpt->getRealArrayItem(rawData(), rawDataSizeMax(), item_name, darray, status);
393  }
394  int getRealArrayItem(const char* item_name, float* farray, DAEstatus& status) const
395  {
396  return m_crpt->getRealArrayItem(rawData(), rawDataSizeMax(), item_name, farray, status);
397  }
399  uint32_t spectrumCRPTOffset(int spec, int daq_period) const;
400 // static void histogramEventsToCRPT(const ISISCRPT_STRUCT* crpt, ISISCRPT_DATA* crpt_data, const DAEEventHeader* head, const DetectorEvent32* ev, int n, int event_source_id);
401  static void histogramEventsToCRPT(const ISISCRPT_STRUCT* crpt1, const ISISCRPT_STRUCT* crpt2, ISISCRPT_DATA* crpt_data1, ISISCRPT_DATA* crpt_data2, const DAEEventHeader* head, const DetectorEvent32* ev, int n, int event_source_id);
402  static void histogramEventsToCRPT(CRPTProxy& crpt, const DAEEventHeader* head, const DetectorEvent32* ev, int n, int event_source_id);
403  static void histogramEventsToCRPT(CRPTProxy& crpt1, CRPTProxy& crpt2, const DAEEventHeader* head, const DetectorEvent32* ev, int n, int event_source_id);
404 };
405 
406 inline uint32_t CRPTProxy::spectrumCRPTOffset(int spec, int daq_period) const
407 {
408  return m_crpt->spectrumCRPTOffsetImpl(spec, daq_period, rawDataSizeMax());
409 }
410 
411 #endif /* CRPT_PROXY */
ISISCRPT_DATA m_crpt_data
Definition: CRPTProxy.h:253
std::string m_monitoring_log
Definition: CRPTProxy.h:266
int createFrom(CRPTProxy &proxy_clone, int id, bool blank_raw_data, DAEstatus &status)
Definition: CRPTProxy.cpp:355
static void histogramEventsToCRPT(const ISISCRPT_STRUCT *crpt1, const ISISCRPT_STRUCT *crpt2, ISISCRPT_DATA *crpt_data1, ISISCRPT_DATA *crpt_data2, const DAEEventHeader *head, const DetectorEvent32 *ev, int n, int event_source_id)
Definition: CRPTProxy.cpp:437
Poco::Mutex m_crpt_lock
Definition: CRPTProxy.h:250
#define ERRTYPE_OUTOFMEM
void zeroSpectrum(int spec, int)
Definition: CRPTProxy.h:28
int getIntArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, long *larray, DAEstatus &status) const
Definition: isiscrpt.cpp:755
int getPeriodSize() const
Definition: isiscrpt.h:658
int getRealArrayItem(const char *item_name, const long *spec_array, int nspec, double *darray, DAEstatus &status) const
Definition: CRPTProxy.h:382
ISISCRPT_DATA * crptData()
Definition: CRPTProxy.h:284
int addVa(int facility, int severity, int errtype, const char *format,...)
Definition: DAEstatus.cpp:54
const ISISCRPT_STRUCT * operator->() const
Definition: CRPTProxy.h:353
#define SEV_WARNING
std::string m_debug_log
Definition: CRPTProxy.h:265
std::string fileName() const
Definition: CRPTProxy.h:53
void invalidateHandles()
Definition: CRPTProxy.h:274
void unload(bool delete_file)
Definition: CRPTProxy.h:75
isisU32_t * rawData()
Definition: CRPTProxy.h:55
time_t m_raw_data_update_time
Definition: CRPTProxy.h:261
const std::string & eventLog() const
Definition: CRPTProxy.h:288
void zeroRawData(isisU32_t data_size=0)
Definition: CRPTProxy.h:59
isisU32_t * m_spec_integrals
Definition: CRPTProxy.h:11
void init()
Definition: CRPTProxy.h:21
HANDLE m_crpt_data_fh
Definition: CRPTProxy.h:13
uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period) const
Definition: isiscrpt.h:624
isisU32_t m_spec_integrals_size
in words
Definition: CRPTProxy.h:12
fixed header marker for DAEEventHeader
Definition: dae_events.h:44
int loadCRPT(const char *crpt_file, const char *crpt_name, const char *crpt_data_file, const char *crpt_data_name, int crpt_data_size, bool read_only, DAEstatus &status)
Definition: CRPTProxy.cpp:204
std::string fileNameFromMappedView(void *pMem)
Definition: icputils.cpp:1033
time_t start_time
Definition: isiscrpt.h:254
const std::string & statusLog() const
Definition: CRPTProxy.h:287
time_t rawDataUpdateTime() const
Definition: CRPTProxy.h:297
void rawDataUpdated()
Definition: CRPTProxy.h:296
unsigned long isisU32_t
Definition: isisvme_types.h:8
int flushSection(void *address, HANDLE file_handle, DAEstatus &status)
Definition: CRPTProxy.cpp:10
static const int Failure
Definition: DAEstatus.h:141
int add(DAEstatus &dstatus, bool clear)
Definition: DAEstatus.cpp:131
isisU32_t * m_crpt_data
this will also be the base address for all mappings
Definition: CRPTProxy.h:9
std::string dataSectionName() const
Definition: CRPTProxy.h:301
#define ISISCRPT_MAX_DETECTOR
Definition: isiscrpt.h:14
int getIntArrayItem(const char *item_name, const long *spec_array, int nspec, long *larray, DAEstatus &status) const
Definition: CRPTProxy.h:374
SECURITY_ATTRIBUTES * defaultNoInheritHandles()
Definition: icputils.cpp:1121
static const int Success
Definition: DAEstatus.h:140
std::string m_crpt_data_file
Definition: CRPTProxy.h:15
const std::string & debugLog() const
Definition: CRPTProxy.h:289
const isisU32_t * rawData() const
Definition: CRPTProxy.h:56
int flush()
Definition: CRPTProxy.h:69
isisU32_t rawDataSizeMax() const
Definition: CRPTProxy.h:298
const std::string & monitoringLog() const
Definition: CRPTProxy.h:290
int assignLogFiles(const std::string &prefix)
Definition: CRPTProxy.cpp:388
int load(const char *crpt_data_file, HANDLE crpt_data_fh, const char *crpt_data_name, int crpt_data_size, bool read_only, DAEstatus &status)
Definition: CRPTProxy.h:147
std::string m_event_log
Definition: CRPTProxy.h:264
int unloadCRPT(bool delete_crpt_file, bool delete_crpt_data_file, DAEstatus &status)
Definition: CRPTProxy.cpp:47
void copy(const ISISCRPT_DATA &clone)
Definition: CRPTProxy.h:43
#define FAC_CRPT
HANDLE m_crpt_fm
Definition: CRPTProxy.h:256
int updateFrom(CRPTProxy &proxy_clone, bool copy_raw_data, DAEstatus &status)
Definition: CRPTProxy.cpp:369
isisU32_t m_crpt_data_size
in words
Definition: CRPTProxy.h:10
int getIntArrayItem(const char *item_name, long *larray, DAEstatus &status) const
Definition: CRPTProxy.h:378
#define SEV_ERROR
bool isValid() const
Definition: CRPTProxy.h:351
isisU32_t * rawData()
Definition: CRPTProxy.h:302
std::string m_comp_name
Definition: CRPTProxy.h:258
std::string m_crpt_name
name of memory section
Definition: CRPTProxy.h:260
CRPTProxy(const CRPTProxy &)
Definition: CRPTProxy.h:273
bool valid() const
Definition: CRPTProxy.h:68
#define LOGSTR_INFORMATION(__arg)
Definition: IsisBase.h:78
void setICPStartTime(time_t t)
Definition: CRPTProxy.h:324
std::string m_timediff_log
Definition: CRPTProxy.h:267
#define LOGSTR_ERROR(__arg)
Definition: IsisBase.h:99
isisU32_t * spectrumIntegrals()
Definition: CRPTProxy.h:311
int loadOrCreate(const char *crpt_data_file, const char *crpt_data_name, int crpt_data_size, DAEstatus &status)
Definition: CRPTProxy.h:97
isisU32_t dataFileSize() const
Definition: CRPTProxy.h:320
std::string m_status_log
time of last full scale update of raw_data
Definition: CRPTProxy.h:263
int getRealArrayItem(const char *item_name, float *farray, DAEstatus &status) const
Definition: CRPTProxy.h:394
parameter_map_t & sampleParameters()
Definition: CRPTProxy.h:292
int getRealArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, double *darray, DAEstatus &status) const
Definition: isiscrpt.cpp:775
void zeroAllRawData(DAEstatus &status)
Definition: CRPTProxy.h:328
isisU32_t rawDataSizeUsed() const
Definition: CRPTProxy.h:299
int mapCRPT(const std::string &crpt_name, const std::string &crpt_data_name, bool read_only, bool existing)
Definition: CRPTProxy.cpp:289
int map(const std::string &crpt_data_name, bool read_only, bool)
Definition: CRPTProxy.h:188
std::string m_crpt_data_name
name of memory section
Definition: CRPTProxy.h:16
parameter_map_t m_sample_parameters
Definition: CRPTProxy.h:270
time_t icp_start_time
Definition: isiscrpt.h:244
Base(const std::string &logger_name="UNKNOWN")
Definition: IsisBase.h:13
std::string sectionName() const
Definition: CRPTProxy.h:54
parameter_map_t m_beamline_parameters
Definition: CRPTProxy.h:271
std::string m_crpt_file
Definition: CRPTProxy.h:259
Poco::Mutex m_data_lock
Definition: CRPTProxy.h:251
ISISCRPT_STRUCT * m_crpt
Definition: CRPTProxy.h:252
int getRealArrayItem(const char *item_name, double *darray, DAEstatus &status) const
Definition: CRPTProxy.h:390
Poco::Mutex & getDataLockRef()
Definition: CRPTProxy.h:286
bool isRawDataCacheValid() const
Definition: CRPTProxy.h:398
HANDLE m_crpt_fh
Definition: CRPTProxy.h:255
parameter_t(const std::string &t, const std::string &u, const std::string &v)
Definition: CRPTProxy.h:246
std::map< std::string, parameter_t > parameter_map_t
Definition: CRPTProxy.h:248
ISISCRPT_STRUCT * CRPT()
Definition: CRPTProxy.h:348
isisU32_t fileSizeMax() const
Definition: CRPTProxy.h:52
void zeroUsedRawData(DAEstatus &status)
Definition: CRPTProxy.h:335
const std::string & timeDiffLog() const
Definition: CRPTProxy.h:291
HANDLE m_crpt_data_fm
Definition: CRPTProxy.h:14
isisU32_t * spectrumIntegrals()
Definition: CRPTProxy.h:57
const ISISCRPT_STRUCT * CRPT() const
Definition: CRPTProxy.h:349
void incrementSpectrum(int spec, int)
Definition: CRPTProxy.h:35
parameter_map_t & beamlineParameters()
Definition: CRPTProxy.h:293
ISISCRPT_STRUCT * operator->()
Definition: CRPTProxy.h:352
void zeroEventRawData(DAEstatus &status)
Definition: CRPTProxy.cpp:487
int flushCRPT(DAEstatus &status, bool flush_raw_data=false)
Definition: CRPTProxy.cpp:30
Poco::Mutex & getLockRef()
Definition: CRPTProxy.h:285
const isisU32_t * spectrumIntegrals() const
Definition: CRPTProxy.h:58
int addInfoVa(int facility, const char *format,...)
Definition: DAEstatus.cpp:91
const isisU32_t * spectrumIntegrals() const
Definition: CRPTProxy.h:316
uint32_t spectrumCRPTOffset(int spec, int daq_period) const
Definition: CRPTProxy.h:406
ISISDAE::DAEType m_dae_type
Definition: CRPTProxy.h:257
std::string dataFileName() const
Definition: CRPTProxy.h:300
isisU32_t rawDataSizeMax() const
Definition: CRPTProxy.h:51
int loadOrCreateCRPT(const std::string &crpt_file, const std::string &crpt_name, const std::string &crpt_data_file, const std::string &crpt_data_name, int crpt_data_size, ISISDAE::DAEType dae_type, const std::string &comp_name, boost::function< int(DAEstatus &)> readRecoveryFile, DAEstatus &status)
Definition: CRPTProxy.cpp:76
~CRPTProxy()
Definition: CRPTProxy.h:368
int unloadCRPT(DAEstatus &status)
Definition: CRPTProxy.h:367
const isisU32_t * rawData() const
Definition: CRPTProxy.h:307
int64_t fileSizeBytes(const std::string &filename)
Definition: icputils.cpp:1049
int getRealArrayItem(const char *item_name, const long *spec_array, int nspec, float *farray, DAEstatus &status) const
Definition: CRPTProxy.h:386
DAEType
Definition: isisdae.h:63