This commit is contained in:
2024-03-02 20:56:55 +01:00
parent 2fc7122b71
commit 42d2b54c83
5 changed files with 180 additions and 47 deletions

View File

@@ -15,38 +15,6 @@
#include <stdexcept>
#include <vector>
#include <string>
#include "ecmcDataItem.h"
/* Class to store data channels */
class ecmcDAQChannelItem {
public:
ecmcDAQChannelItem(char* name, int formatAsTime) {
dataItem_ = NULL;
dataItemInfo_ = NULL;
name_ = name;
timeFormat_ = formatAsTime; // micro s in int32
}
void connectToSource() {
// Get data item
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 for an data channel */
class ecmcDAQDataChannel {
@@ -54,13 +22,16 @@ class ecmcDAQDataChannel {
ecmcDAQDataChannel(int type);
~ecmcDAQDataChannel();
void connectToSources();
void execute();
void addDataItem(char* name, int timeFormat);
size_t getDataElementCount();
double getData();
bool empty();
private:
std::vector<ecmcDAQChannelItem*> dataItems_;
size_t itemCounter_;
double type_;
size_t dataElementCount_;
};
#endif /* ECMC_DAQ_DATA_CHANNEL_H_ */