#pragma once #ifndef REAL_BUILD # include "externals.hh" #endif enum class E_SyncSegment { LINEAR , RAMP , SMOOTH , //HERMITE }; struct T_SyncSegment { uint32_t nPoints; E_SyncSegment type; std::vector< float > values; // nPoints items std::vector< uint32_t > durations; // nPoints - 1 items }; using T_SyncVariable = std::vector< T_SyncSegment >; struct T_SyncData { T_SyncData( ) = delete; T_SyncData( __rd__ const uint32_t duration , __rd__ const float units ) noexcept; void setSyncVariable( __rd__ std::string const& name , __rw__ T_SyncVariable&& variable ) noexcept; T_SyncVariable const& variable( __rd__ std::string const& name ) const noexcept; float valueOf( __rd__ std::string const& variable , __rd__ const float time ) const noexcept; private: static const T_SyncVariable MissingVariable_; // Caching structure used to access segments using T_SegRef_ = std::pair< uint32_t , uint32_t >; struct T_VarHelper_ { T_SyncVariable variable; std::vector< T_SegRef_ > segRefs; std::vector< float > segStarts; T_VarHelper_( __rw__ T_SyncVariable&& variable , __rd__ const uint32_t duration ) noexcept; }; uint32_t duration_; float units_; std::unordered_map< std::string , T_VarHelper_ > variables_; };