This commit is contained in:
2024-03-01 20:18:52 +01:00
parent b99a9e35ca
commit c1b7742561
8 changed files with 133 additions and 1629 deletions

70
src/ecmcDAQDataArray.h Normal file
View File

@@ -0,0 +1,70 @@
/*************************************************************************\
* Copyright (c) 2024 PSI
* ecmc is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*
* ecmcDAQDataArray.h
*
* Created on: Mar 01, 2024
* Author: anders sandstrom
*
\*************************************************************************/
#ifndef ECMC_DAQ_DATA_ARRAY_H_
#define ECMC_DAQ_DATA_ARRAY_H_
#include <stdexcept>
#include <vector>
#include <string>
#include "ecmcDAQDataArray.h"
#include "ecmcDataItem.h"
/* Class to store data channels */
class ecmcDataChannel {
public:
ecmcDataChannel(char* name, int formatAsTime) {
dataItem_ = NULL;
dataItemInfo_ = NULL;
name_ = name;
timeFormat_ = formatAsTime;
}
void connectToSource() {
// Get data item for
dataItem_ = (ecmcDataItem*) getEcmcDataItem(name_.c_str());
if(!dataItem_) {
printf("ERROR: DataItem %s NULL.\n", name_.c_str());
throw std::runtime_error( "ERROR: DataItem NULL." );
}
dataItemInfo_ = dataItem_->getDataItemInfo();
if(!dataItemInfo_) {
printf("ERROR: DataItemInfo %s NULL.\n", name_.c_str());
throw std::runtime_error( "ERROR: DataItemInfo NULL." );
}
}
ecmcDataItem* dataItem_;
ecmcDataItemInfo* dataItemInfo_;
std::string name_;
int timeFormat_;
};
/* Class to fromat an array of ecmcDataChannels with headers and push over asyn to epics */
class ecmcDAQDataArray {
public:
ecmcDAQDataArray(size_t nelm);
~ecmcDAQDataArray();
void connectToDataSources();
void execute();
void addDataItem(char* name, int timeFormat);
private:
double *buffer_;
std::vector<ecmcDataChannel*> dataChannels_;
size_t channelCounter_;
};
#endif /* ECMC_DAQ_DATA_ARRAY_H_ */