26 #include <aleth/buildinfo.h> 32 char const*
Version = aleth_get_buildinfo()->project_version;
36 void InvariantChecker::checkInvariants(
HasInvariants const* _this,
char const* _fn,
char const* _file,
int _line,
bool _pre)
40 cwarn << (_pre ?
"Pre" :
"Post") <<
"invariant failed in" << _fn <<
"at" << _file <<
":" << _line;
41 ::boost::exception_detail::throw_exception_(FailedInvariant(), _fn, _file, _line);
45 TimerHelper::~TimerHelper()
47 auto e = std::chrono::high_resolution_clock::now() - m_t;
48 if (!m_ms || e > chrono::milliseconds(m_ms))
50 << m_id <<
" " << chrono::duration_cast<chrono::milliseconds>(e).count() <<
" ms";
74 for (
unsigned i = _units.size() - 1; !!i; --i)
77 if (b > biggest * 1000)
79 ret << (b / biggest) <<
" " << _units.back();
82 ret << setprecision(3);
85 for (
auto it = _units.rbegin(); it != _units.rend(); ++it)
88 if (i != _units.front() && b >= unit)
90 ret << (double(b / (unit / 1000)) / 1000.0) <<
" " << i;
96 ret << b <<
" " << _units.front();
116 if (!std::setlocale(LC_ALL,
""))
118 setenv(
"LC_ALL",
"C", 1);
125 SetConsoleOutputCP(CP_UTF8);
129 bool ExitHandler::s_shouldExit =
false;
133 return _m ==
"on" || _m ==
"yes" || _m ==
"true" || _m ==
"1";
138 return _m ==
"off" || _m ==
"no" || _m ==
"false" || _m ==
"0";
Inheritable for classes that have invariants.
bool isTrue(std::string const &_m)
int64_t utcTime()
Get the current time in seconds since the epoch in UTC.
std::vector< std::string > strings
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> > bigint
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...
std::string const EmptyString
std::vector< byte > bytes
virtual bool invariants() const =0
Reimplement to specify the invariants.
void setDefaultOrCLocale()
bool isFalse(std::string const &_m)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
#define clog(SEVERITY, CHANNEL)