30 auto ModuleParams = DynExp::dynamic_Params_cast<ArbitraryFunctionFromCSV>(Instance->
ParamsGetter());
35 if (ModuleParams->Communicator.ContainsID())
58 std::string CSVDataPath;
60 double TimeStretch{}, TimeOffset{}, ValueStretch{}, ValueOffset{};
63 auto ModuleParams = DynExp::dynamic_Params_cast<ArbitraryFunctionFromCSV>(Instance->
ParamsGetter());
65 CSVDataPath = ModuleParams->CSVDataPath.GetPath().string();
66 SkipLines = ModuleParams->SkipLines;
67 TimeStretch = ModuleParams->TimeStretch;
68 TimeOffset = ModuleParams->TimeOffset;
69 ValueStretch = ModuleParams->ValueStretch;
70 ValueOffset = ModuleParams->ValueOffset;
76 std::vector<DynExpInstr::BasicSample> BasicSamples;
82 auto ParsedCSV = Util::ParseCSV<double, double>(CSVData,
';', SkipLines);
84 for (
const auto& ParsedTuple : ParsedCSV)
85 BasicSamples.emplace_back(std::get<1>(ParsedTuple) * ValueStretch + ValueOffset, std::get<0>(ParsedTuple) * TimeStretch + TimeOffset);
87 catch ([[maybe_unused]] std::ios_base::failure& e)
90 auto ParsedCSV = Util::ParseCSV<double>(CSVData,
';', SkipLines);
92 for (
const auto& ParsedTuple : ParsedCSV)
93 BasicSamples.emplace_back(std::get<0>(ParsedTuple) * ValueStretch + ValueOffset);
96 catch ([[maybe_unused]] std::ios_base::failure& e)
103 ModuleData->FunctionGenerator->SetArbitraryFunction(std::move(BasicSamples),
true);
Implementation of a module to read a waveform from a CSV file and to store it in a data stream of a f...
void ResetImpl(dispatch_tag< ModuleDataBase >) override final
void ResetImpl(dispatch_tag< ModuleBase >) override final
void OnExit(DynExp::ModuleInstance *Instance) const override final
This event is triggered right before the module thread terminates (not due to an exception,...
void OnInit(DynExp::ModuleInstance *Instance) const override final
This event is triggered right before the module thread starts. Override it to lock instruments this m...
Util::DynExpErrorCodes::DynExpErrorCodes ModuleMainLoop(DynExp::ModuleInstance &Instance) override final
Module main loop. The function is executed periodically by the module thread. Also refer to GetMainLo...
void OnTrigger(DynExp::ModuleInstance *Instance) const
static void Register(const ModuleBase &Listener, CallableT EventFunc, ItemIDType CommunicatorID=ItemIDNotSet)
Registers/Subscribes module Listener to the event with the event function EventFunc....
static void Deregister(const ModuleBase &Listener)
Deregisters/unsubscribes module Listener from the event, regardless of the inter-module communicator ...
const std::unique_ptr< ModuleDataType > ModuleData
Module data belonging to this ModuleBase instance.
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
const ModuleBase::ModuleDataGetterType ModuleDataGetter
Getter for module's data. Refer to ModuleBase::ModuleDataGetterType.
Refer to ParamsBase::dispatch_tag.
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
void UnlockObject(LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer)
Unlocks an Object instance stored in the LinkedObjectWrapperContainer ObjectWrapperContainer....
void LockObject(const ParamsBase::Param< ObjectLink< ObjectT > > &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< O...
Data to operate on is invalid for a specific purpose. This indicates a corrupted data structure or fu...
DynExp's module namespace contains the implementation of DynExp modules which extend DynExp's core fu...
DynExpErrorCodes
DynExp's error codes
std::string ReadFromFile(const QString &Filename)
Reads the entire content from a text file.
Accumulates include statements to provide a precompiled header.