// like Checkpoint, but memory-backed instead of file-backed and only // storing the last time/value-paiir -> NO ACTUAL CHECKPOINTS #ifndef kR1Z42gIzRShmbO3sKvSk0HIEo #define kR1Z42gIzRShmbO3sKvSk0HIEo #include #include "array.hpp" #include "string_helpers.hpp" #include "simlimits.hpp" #include "template_helpers.hpp" #include "time.hpp" template class EphermalCheckpoint { public: typedef uint32_t ptr_t; EphermalCheckpoint(string name, const T initialValue); // read access inline Time getTime (const Time t, const ptr_t i); inline T getValue(const Time t, const ptr_t i); inline Time getTime (const Time t); // only with size == 1 inline T getValue(const Time t); // only with size == 1 // write access inline void set(const Time t, const ptr_t i, const T val); inline void set(const Time t, const T val); // only with size == 1 void sync() const {}; // memory backed data; they store for each element the ... Array content; // ... last known content Array times; // ... associated time private: EphermalCheckpoint(); }; template inline void EphermalCheckpoint::set(const Time t, const ptr_t i, const T val) { times.set(i, t); content.set(i, val); } template inline void EphermalCheckpoint::set(const Time t, const T val) { BOOST_STATIC_ASSERT(size == 1); setValue(t, 0, val); } template inline Time EphermalCheckpoint::getTime(const Time t, const ptr_t i) { return times.get(i); } template inline Time EphermalCheckpoint::getTime(const Time t) { BOOST_STATIC_ASSERT(size == 1); return getTime(t, 0); } template inline T EphermalCheckpoint::getValue(const Time t, const ptr_t i) { return content.get(i); } template inline T EphermalCheckpoint::getValue(const Time t) { BOOST_STATIC_ASSERT(size == 1); return getValue(t, 0); } template EphermalCheckpoint::EphermalCheckpoint(string name, const T initialValue) { for (ptr_t i=0; i