eis/TestProject/play_gruond/HoldTime.h

30 lines
708 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <chrono>
#include <cmath>
#include <limits>
#include <string>
#include <tuple>
class HoldTime {
public:
HoldTime(double time);
~HoldTime();
/**
* @brief
* @param exp_str My Param doc
* @return std::tuple<bool, double, std::string, std::string>
* 是否存在时间tagi变量名
*/
static std::tuple<bool, double, std::string, std::string> find_hold(
std::string exp_str);
public:
void update_value(double tag_value);
inline operator bool(void) const { return value; }
inline bool get_value(void) const { return value; }
private:
double last_value;
double hold_time;
bool value;
std::chrono::system_clock::time_point last_time;
};