Ethereum  PoC-8
The C++ Implementation of Ethereum
Common.h File Reference
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <unordered_set>
#include <functional>
#include <string>
#include <chrono>
#include <boost/multiprecision/cpp_int.hpp>
#include "vector_ref.h"

Go to the source code of this file.

Classes

class  dev::secure_vector< T >
 
class  dev::ScopeGuard
 RAII utility class whose destructor calls a given function. More...
 
class  dev::HasInvariants
 Inheritable for classes that have invariants. More...
 
class  dev::InvariantChecker
 RAII checker for invariant assertions. More...
 
class  dev::TimerHelper
 Simple scope-based timer helper. More...
 
class  dev::Timer
 
class  dev::ExitHandler
 

Namespaces

 dev
 

Macros

#define DEV_IGNORE_EXCEPTIONS(X)   try { X; } catch (...) {}
 
#define DEV_IF_THROWS(X)   try{X;}catch(...)
 
#define DEV_INVARIANT_CHECK   (void)0;
 Scope guard for invariant check in a class derived from HasInvariants. More...
 
#define DEV_INVARIANT_CHECK_HERE   (void)0;
 
#define DEV_TIMED(S)   for (::std::pair<::dev::TimerHelper, bool> __eth_t(S, true); __eth_t.second; __eth_t.second = false)
 
#define DEV_TIMED_SCOPE(S)   ::dev::TimerHelper __eth_t(S)
 
#define DEV_TIMED_FUNCTION   DEV_TIMED_SCOPE(__PRETTY_FUNCTION__)
 
#define DEV_TIMED_ABOVE(S, MS)   for (::std::pair<::dev::TimerHelper, bool> __eth_t(::dev::TimerHelper(S, MS), true); __eth_t.second; __eth_t.second = false)
 
#define DEV_TIMED_SCOPE_ABOVE(S, MS)   ::dev::TimerHelper __eth_t(S, MS)
 
#define DEV_TIMED_FUNCTION_ABOVE(MS)   DEV_TIMED_SCOPE_ABOVE(__PRETTY_FUNCTION__, MS)
 
#define DEV_UNUSED   __attribute__((unused))
 

Typedefs

using byte = uint8_t
 
using dev::bytes = std::vector< byte >
 
using dev::bytesRef = vector_ref< byte >
 
using dev::bytesConstRef = vector_ref< byte const >
 
using dev::bytesSec = secure_vector< byte >
 
using dev::bigint = boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> >
 
using dev::u64 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::u128 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::u256 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::s256 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::u160 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::s160 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::u512 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::s512 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > >
 
using dev::u256s = std::vector< u256 >
 
using dev::u160s = std::vector< u160 >
 
using dev::u256Set = std::set< u256 >
 
using dev::u160Set = std::set< u160 >
 
using dev::StringMap = std::map< std::string, std::string >
 
using dev::BytesMap = std::map< bytes, bytes >
 
using dev::u256Map = std::map< u256, u256 >
 
using dev::HexMap = std::map< bytes, bytes >
 
using dev::StringHashMap = std::unordered_map< std::string, std::string >
 
using dev::u256HashMap = std::unordered_map< u256, u256 >
 
using dev::strings = std::vector< std::string >
 

Enumerations

enum  dev::WithExisting : int { dev::WithExisting::Trust = 0, dev::WithExisting::Verify, dev::WithExisting::Rescue, dev::WithExisting::Kill }
 

Functions

s256 dev::u2s (u256 _u)
 Interprets _u as a two's complement signed number and returns the resulting s256. More...
 
u256 dev::s2u (s256 _u)
 
string dev::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. More...
 
unsigned int dev::toLog2 (u256 _x)
 
template<size_t n>
u256 dev::exp10 ()
 
template<>
u256 dev::exp10< 0 > ()
 
template<class N >
dev::diff (N const &_a, N const &_b)
 
int64_t dev::utcTime ()
 Get the current time in seconds since the epoch in UTC. More...
 
void dev::setDefaultOrCLocale ()
 
bool dev::isTrue (std::string const &_m)
 
bool dev::isFalse (std::string const &_m)
 

Variables

constexpr u256 dev::Invalid256
 

Detailed Description

Author
Gav Wood i@gav.nosp@m.wood.nosp@m..com
Date
2014

Very common stuff (i.e. that every other header needs except vector_ref.h).

Definition in file Common.h.

Macro Definition Documentation

◆ DEV_IF_THROWS

#define DEV_IF_THROWS (   X)    try{X;}catch(...)

Definition at line 62 of file Common.h.

◆ DEV_IGNORE_EXCEPTIONS

#define DEV_IGNORE_EXCEPTIONS (   X)    try { X; } catch (...) {}

Definition at line 60 of file Common.h.

◆ DEV_INVARIANT_CHECK

#define DEV_INVARIANT_CHECK   (void)0;

Scope guard for invariant check in a class derived from HasInvariants.

Definition at line 239 of file Common.h.

◆ DEV_INVARIANT_CHECK_HERE

#define DEV_INVARIANT_CHECK_HERE   (void)0;

Definition at line 240 of file Common.h.

◆ DEV_TIMED

#define DEV_TIMED (   S)    for (::std::pair<::dev::TimerHelper, bool> __eth_t(S, true); __eth_t.second; __eth_t.second = false)

Definition at line 269 of file Common.h.

◆ DEV_TIMED_ABOVE

#define DEV_TIMED_ABOVE (   S,
  MS 
)    for (::std::pair<::dev::TimerHelper, bool> __eth_t(::dev::TimerHelper(S, MS), true); __eth_t.second; __eth_t.second = false)

Definition at line 277 of file Common.h.

◆ DEV_TIMED_FUNCTION

#define DEV_TIMED_FUNCTION   DEV_TIMED_SCOPE(__PRETTY_FUNCTION__)

Definition at line 274 of file Common.h.

◆ DEV_TIMED_FUNCTION_ABOVE

#define DEV_TIMED_FUNCTION_ABOVE (   MS)    DEV_TIMED_SCOPE_ABOVE(__PRETTY_FUNCTION__, MS)

Definition at line 282 of file Common.h.

◆ DEV_TIMED_SCOPE

#define DEV_TIMED_SCOPE (   S)    ::dev::TimerHelper __eth_t(S)

Definition at line 270 of file Common.h.

◆ DEV_TIMED_SCOPE_ABOVE

#define DEV_TIMED_SCOPE_ABOVE (   S,
  MS 
)    ::dev::TimerHelper __eth_t(S, MS)

Definition at line 278 of file Common.h.

◆ DEV_UNUSED

#define DEV_UNUSED   __attribute__((unused))

Definition at line 289 of file Common.h.

Typedef Documentation

◆ byte

using byte = uint8_t

Definition at line 57 of file Common.h.