File size: 1,386 Bytes
d1be154 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #ifndef OT_TIMER_CPPR_HPP_
#define OT_TIMER_CPPR_HPP_
#include <ot/headerdef.hpp>
namespace ot {
// Forward declaration
class Pin;
// ----------------------------------------------------------------------------
// Struct: CpprAnalysis
struct CpprAnalysis {
// TODO
};
// ----------------------------------------------------------------------------
// Struct: Cppr
struct Cppr {
Pin& pin;
Tran rf;
float credit;
inline Cppr(Pin&, Tran, float);
inline operator float() const;
};
// Constructor
inline Cppr::Cppr(Pin& pin, Tran rf, float c) :
pin {pin},
rf {rf},
credit {c} {
}
// operator
inline Cppr::operator float() const {
return credit;
}
// ----------------------------------------------------------------------------
// CpprCache: The internal thread-local storage for cppr.
class CpprCache {
friend class Timer;
public:
CpprCache(size_t);
CpprCache(const CpprCache&) = delete;
CpprCache(CpprCache&&);
~CpprCache();
CpprCache& operator = (const CpprCache&) = delete;
CpprCache& operator = (CpprCache&&) = delete;
private:
inline thread_local static std::vector<std::optional<size_t>> __capp;
size_t _capb; // beg
size_t _cape; // end
std::unordered_set<size_t> _pins;
};
}; // end of namespace ot. -----------------------------------------------------------------------
#endif
|