29 std::string CSVDataPath;
31 double TimeStretch{}, TimeOffset{}, ValueStretch{}, ValueOffset{};
34 auto ModuleParams = DynExp::dynamic_Params_cast<ArbitraryFunctionFromCSV>(Instance->
ParamsGetter());
39 CSVDataPath = ModuleParams->CSVDataPath.GetPath().string();
40 SkipLines = ModuleParams->SkipLines;
41 TimeStretch = ModuleParams->TimeStretch;
42 TimeOffset = ModuleParams->TimeOffset;
43 ValueStretch = ModuleParams->ValueStretch;
44 ValueOffset = ModuleParams->ValueOffset;
50 std::vector<DynExpInstr::BasicSample> BasicSamples;
56 auto ParsedCSV = Util::ParseCSV<double, double>(CSVData,
';', SkipLines);
58 for (
const auto& ParsedTuple : ParsedCSV)
59 BasicSamples.emplace_back(std::get<1>(ParsedTuple) * ValueStretch + ValueOffset, std::get<0>(ParsedTuple) * TimeStretch + TimeOffset);
61 catch ([[maybe_unused]] std::ios_base::failure& e)
64 auto ParsedCSV = Util::ParseCSV<double>(CSVData,
';', SkipLines);
66 for (
const auto& ParsedTuple : ParsedCSV)
67 BasicSamples.emplace_back(std::get<0>(ParsedTuple) * ValueStretch + ValueOffset);
70 catch ([[maybe_unused]] std::ios_base::failure& e)
77 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...
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.