104 FILE_ATTRIBUTE_NORMAL , NULL);
121 remove(crpt_data_file);
123 FILE_ATTRIBUTE_NORMAL , NULL);
126 status.
addInfoVa(
FAC_CRPT,
"CRPT data \"%s\" size %Id KB", crpt_data_file, size.QuadPart / 1024);
128 if (
m_crpt_data_fm == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
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)
150 int file_map_mode = (read_only ? PAGE_READONLY : PAGE_READWRITE);
151 int view_map_mode = (read_only ? FILE_MAP_READ : FILE_MAP_WRITE);
155 if (GetFileSizeEx(crpt_data_fh, &size) == 0)
168 if (
m_crpt_data_fm == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
188 int map(
const std::string& crpt_data_name,
bool read_only,
bool )
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 )
205 if (fname.size() > 0)
210 LOGSTR_ERROR(fname <<
" has zero size - assuming c:\\data\\data.run and trying again");
215 LOGSTR_ERROR(fname <<
"c:\\data\\data.run has zero size - exiting");
295 int assignLogFiles(
bool use_full_inst_name_for_files,
const std::string& data_dir,
int run_number_digits);
331 ICPTimer timer(
"CRPTProxy::zeroAllRawData", status);
338 ICPTimer timer(
"CRPTProxy::zeroUsedRawData", status);
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,
360 const char* crpt_data_file,
const char* crpt_data_name,
int crpt_data_size,
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);
ISISCRPT_DATA m_crpt_data
std::string m_monitoring_log
int createFrom(CRPTProxy &proxy_clone, int id, bool blank_raw_data, DAEstatus &status)
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)
void zeroSpectrum(int spec, int)
int getIntArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, long *larray, DAEstatus &status) const
int getPeriodSize() const
int getRealArrayItem(const char *item_name, const long *spec_array, int nspec, double *darray, DAEstatus &status) const
ISISCRPT_DATA * crptData()
int addVa(int facility, int severity, int errtype, const char *format,...)
const ISISCRPT_STRUCT * operator->() const
std::string fileName() const
void unload(bool delete_file)
time_t m_raw_data_update_time
const std::string & eventLog() const
void zeroRawData(isisU32_t data_size=0)
isisU32_t * m_spec_integrals
uint32_t spectrumCRPTOffsetImpl(int spec, int daq_period) const
isisU32_t m_spec_integrals_size
in words
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)
std::string fileNameFromMappedView(void *pMem)
const std::string & statusLog() const
time_t rawDataUpdateTime() const
int flushSection(void *address, HANDLE file_handle, DAEstatus &status)
int add(DAEstatus &dstatus, bool clear)
isisU32_t * m_crpt_data
this will also be the base address for all mappings
std::string dataSectionName() const
#define ISISCRPT_MAX_DETECTOR
int getIntArrayItem(const char *item_name, const long *spec_array, int nspec, long *larray, DAEstatus &status) const
SECURITY_ATTRIBUTES * defaultNoInheritHandles()
std::string m_crpt_data_file
const std::string & debugLog() const
const isisU32_t * rawData() const
isisU32_t rawDataSizeMax() const
const std::string & monitoringLog() const
int assignLogFiles(const std::string &prefix)
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)
int unloadCRPT(bool delete_crpt_file, bool delete_crpt_data_file, DAEstatus &status)
void copy(const ISISCRPT_DATA &clone)
int updateFrom(CRPTProxy &proxy_clone, bool copy_raw_data, DAEstatus &status)
isisU32_t m_crpt_data_size
in words
int getIntArrayItem(const char *item_name, long *larray, DAEstatus &status) const
std::string m_crpt_name
name of memory section
CRPTProxy(const CRPTProxy &)
#define LOGSTR_INFORMATION(__arg)
void setICPStartTime(time_t t)
std::string m_timediff_log
#define LOGSTR_ERROR(__arg)
isisU32_t * spectrumIntegrals()
int loadOrCreate(const char *crpt_data_file, const char *crpt_data_name, int crpt_data_size, DAEstatus &status)
isisU32_t dataFileSize() const
std::string m_status_log
time of last full scale update of raw_data
int getRealArrayItem(const char *item_name, float *farray, DAEstatus &status) const
parameter_map_t & sampleParameters()
int getRealArrayItem(const isisU32_t *raw_data, int raw_data_size, const char *item_name, double *darray, DAEstatus &status) const
void zeroAllRawData(DAEstatus &status)
isisU32_t rawDataSizeUsed() const
int mapCRPT(const std::string &crpt_name, const std::string &crpt_data_name, bool read_only, bool existing)
int map(const std::string &crpt_data_name, bool read_only, bool)
std::string m_crpt_data_name
name of memory section
parameter_map_t m_sample_parameters
Base(const std::string &logger_name="UNKNOWN")
std::string sectionName() const
parameter_map_t m_beamline_parameters
int getRealArrayItem(const char *item_name, double *darray, DAEstatus &status) const
Poco::Mutex & getDataLockRef()
bool isRawDataCacheValid() const
parameter_t(const std::string &t, const std::string &u, const std::string &v)
std::map< std::string, parameter_t > parameter_map_t
isisU32_t fileSizeMax() const
void zeroUsedRawData(DAEstatus &status)
const std::string & timeDiffLog() const
isisU32_t * spectrumIntegrals()
const ISISCRPT_STRUCT * CRPT() const
void incrementSpectrum(int spec, int)
parameter_map_t & beamlineParameters()
ISISCRPT_STRUCT * operator->()
void zeroEventRawData(DAEstatus &status)
int flushCRPT(DAEstatus &status, bool flush_raw_data=false)
Poco::Mutex & getLockRef()
const isisU32_t * spectrumIntegrals() const
int addInfoVa(int facility, const char *format,...)
const isisU32_t * spectrumIntegrals() const
uint32_t spectrumCRPTOffset(int spec, int daq_period) const
ISISDAE::DAEType m_dae_type
std::string dataFileName() const
isisU32_t rawDataSizeMax() const
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)
int unloadCRPT(DAEstatus &status)
const isisU32_t * rawData() const
int64_t fileSizeBytes(const std::string &filename)
int getRealArrayItem(const char *item_name, const long *spec_array, int nspec, float *farray, DAEstatus &status) const