WIP
This commit is contained in:
70
src/ecmcDAQDataChannel.h
Normal file
70
src/ecmcDAQDataChannel.h
Normal 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.
|
||||
*
|
||||
* ecmcDAQDataChannel.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 "ecmcDAQDataChannel.h"
|
||||
#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 {
|
||||
public:
|
||||
ecmcDAQDataChannel(int type);
|
||||
~ecmcDAQDataChannel();
|
||||
void connectToSources();
|
||||
void execute();
|
||||
void addDataItem(char* name, int timeFormat);
|
||||
|
||||
private:
|
||||
std::vector<ecmcDAQChannelItem*> dataItems_;
|
||||
size_t itemCounter_;
|
||||
double type_;
|
||||
};
|
||||
|
||||
#endif /* ECMC_DAQ_DATA_ARRAY_H_ */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user