2#ifndef GRAMODS_TRACK_TRACKERBASE
3#define GRAMODS_TRACK_TRACKERBASE
5#include <gmTrack/config.hh>
7#include <gmCore/io_float.hh>
8#include <gmCore/Object.hh>
9#include <gmCore/Pose.hh>
14BEGIN_NAMESPACE_GMTRACK;
34 typedef std::chrono::steady_clock clock;
41 clock::time_point time;
48 typedef std::unordered_map<std::string, Sample>
State;
55 virtual std::optional<State>
get() = 0;
74 static void merge(std::optional<State> &A, std::optional<State> B) {
84typedef TrackerBase<gmCore::Pose> PoseTracker;
85typedef TrackerBase<bool> BinaryTracker;
86typedef TrackerBase<float> FloatTracker;
87typedef TrackerBase<gmCore::float2> Float2Tracker;
89template<> std::string PoseTracker::getDefaultKey();
90template<> std::string BinaryTracker::getDefaultKey();
91template<> std::string FloatTracker::getDefaultKey();
92template<> std::string Float2Tracker::getDefaultKey();
94#ifdef gramods_ENABLE_nlohmann_json
95void to_json(nlohmann::json &j,
const PoseTracker::Sample &o);
96void from_json(
const nlohmann::json &j, PoseTracker::Sample &o);
98void to_json(nlohmann::json &j,
const BinaryTracker::Sample &o);
99void from_json(
const nlohmann::json &j, BinaryTracker::Sample &o);
101void to_json(nlohmann::json &j,
const FloatTracker::Sample &o);
102void from_json(
const nlohmann::json &j, FloatTracker::Sample &o);
104void to_json(nlohmann::json &j,
const Float2Tracker::Sample &o);
105void from_json(
const nlohmann::json &j, Float2Tracker::Sample &o);
108END_NAMESPACE_GMTRACK;
Base type for objects in the Gramods package for standardized handling of construction,...
Definition Object.hh:42
The base of trackers of pose, float, float2 or bool data.
Definition TrackerBase.hh:30
std::string getDefaultKey() override
Returns the default key, in Configuration, for the Object, i.e.
static void merge(std::optional< State > &A, std::optional< State > B)
Merges the two specified states.
Definition TrackerBase.hh:74
std::unordered_map< std::string, Sample > State
Definition TrackerBase.hh:48
virtual std::optional< State > get()=0
Reads state data.
Type of a single sample, consisting of the collect time and the value.
Definition TrackerBase.hh:40