This commit is contained in:
2024-03-04 11:22:34 +01:00
parent e092ed9dea
commit 21c010d0be
12 changed files with 433 additions and 184 deletions

View File

@@ -1,4 +1,4 @@
7/*************************************************************************\
/*************************************************************************\
* Copyright (c) 2024 PSI
* ecmc is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
@@ -16,25 +16,26 @@
#include <sstream>
#include "ecmcDAQDataChannel.h"
#include "ecmcPluginClient.h"
ecmcDAQDataChannel::ecmcDAQDataChannel(int type){
itemCounter_ = 0;
type_ = (double) type;
dataElementCount_ = 0;
itemCounter_ = 0;
type_ = (double) type;
dataElementCount_ = 0;
returnedDataCounter_ = 0;
currItemIndex_ = 0;
dataSourcesLinked_ = 0;
}
ecmcDAQDataChannel::~ecmcDAQDataChannel() {
}
void ecmcDAQDataChannel::addDataItem(char* name, int timeFormat) {
dataItems_.push_back(new ecmcDAQChannelItem(name, timeFormat);
void ecmcDAQDataChannel::addDataItem(const char* name, int format) {
dataItems_.push_back(new ecmcDAQChannelItem(name, (ecmcDAQDataFormat)format));
itemCounter_++;
}
void ecmcDAQDataChannel::connectToDataSources() {
if( dataSourceLinked_ ) {
if( dataSourcesLinked_ ) {
return;
}
@@ -48,20 +49,40 @@ void ecmcDAQDataChannel::connectToDataSources() {
dataElementCount_ = dataElementCount_ + (*pDataItem)->getDataElementCount();
}
dataSourceLinked_ = 1;
dataSourcesLinked_ = 1;
}
size_t ecmcDAQDataChannel::getDataElementCount(){
return dataElementCount_;
}
double ecmcDAQDataChannel:getData(){
double ecmcDAQDataChannel::getType() {
return type_;
}
bool ecmcDAQDataChannel:empty(){
double ecmcDAQDataChannel::getData(int first){
if(first) {
currItemIndex_ = 0;
} else {
first = false;
}
if(dataItems_[currItemIndex_]->empty()) {
// get first index of next dataItem
first = true;
currItemIndex_++;
}
if(currItemIndex_>=itemCounter_) {
printf("No more data here!!!\n");
return 0;
//throw std::runtime_error( "Item index out of range");
}
returnedDataCounter_++;
return dataItems_[currItemIndex_]->getData(first);
}
bool ecmcDAQDataChannel::empty(){
return dataElementCount_>=returnedDataCounter_;
}