feat: add CsvReplayModel for CSV data replay
This commit is contained in:
parent
afd753f803
commit
2ef663af81
17
TestProject/RNG/model/CsvReplayModel.h
Normal file
17
TestProject/RNG/model/CsvReplayModel.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <TestProject/RNG/model/IModel.h>
|
||||||
|
#include <TestProject/RNG/read_csv.hpp>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
#include <string>
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
struct CsvReplayModel : IModel {
|
||||||
|
ReadCSV::DoubleData data;
|
||||||
|
int column;
|
||||||
|
|
||||||
|
CsvReplayModel(const json& params, float)
|
||||||
|
: data(params["file"].get<std::string>())
|
||||||
|
, column(params["column"].get<int>()) {}
|
||||||
|
|
||||||
|
float evaluate(size_t t) override { return data(t, column); }
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user