Skip to content

Commit

Permalink
update documentation custom data example
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Ferenczi <[email protected]>
  • Loading branch information
5had3z committed Aug 14, 2024
1 parent 578f423 commit 2098619
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions docs/custom_dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,41 @@ Serialized Database

namespace cvt {

struct EntryMeta {
std::string location;
float some_property;
};

struct MyDatasetEntry {
ReplayInfo header;
using header_type = EntryMeta;

EntryMeta header;
std::vector<float> timeseriesA;
std::vector<float> timeseriesB;
};

template<> struct DatabaseInterface<MyDatasetEntry> {

static auto getHeaderImpl(std::istream &dbStream) -> ReplayInfo
static auto getHeaderImpl(std::istream &dbStream) -> EntryMeta
{
ReplayInfo result;
EntryMeta result;
deserialize(result, dbStream);
return result;
};
}

static auto getEntryImpl(std::istream &dbStream) -> MyDatasetEntry
{
MyDatasetEntry data;
deserialize(data, dbStream);
return data;
}

// Implement other methods

};

using CustomDatabase = ReplayDatabase<MyDatasetEntry>;

} // namespace cvt


Expand Down

0 comments on commit 2098619

Please sign in to comment.