26 #include "BuildInfo.h" 34 #define ETH_PROJECT_VERSION "1.3.0" 36 char const*
Version = ETH_PROJECT_VERSION;
40 void InvariantChecker::checkInvariants(
HasInvariants const* _this,
char const* _fn,
char const* _file,
int _line,
bool _pre)
44 cwarn << (_pre ?
"Pre" :
"Post") <<
"invariant failed in" << _fn <<
"at" << _file <<
":" << _line;
45 ::boost::exception_detail::throw_exception_(FailedInvariant(), _fn, _file, _line);
57 TimerHelper::~TimerHelper()
59 auto e = std::chrono::high_resolution_clock::now() - m_t;
60 if (!m_ms ||
e > chrono::milliseconds(m_ms))
85 for (
unsigned i = _units.size() - 1; !!i; --i)
88 if (b > biggest * 1000)
90 ret << (b / biggest) <<
" " << _units.back();
93 ret << setprecision(3);
96 for (
auto it = _units.rbegin(); it != _units.rend(); ++it)
99 if (i != _units.front() && b >= unit)
101 ret << (double(b / (unit / 1000)) / 1000.0) <<
" " << i;
107 ret << b <<
" " << _units.front();
Inheritable for classes that have invariants.
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
uint64_t utcTime()
Get the current time in seconds since the epoch in UTC.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>> bigint
std::vector< std::string > strings
std::hash for asio::adress
string inUnits(bigint const &_b, strings const &_units)
Converts given int to a string and appends one of a series of units according to its size...
virtual bool invariants() const =0
Reimplement to specify the invariants.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
The default logging channels.