Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
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"
Include dependency graph for Common.h:

Go to the source code of this file.


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
struct  std::hash< dev::u256 >


 Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Originally by RenĂ© Nyffenegger.
 std::hash for asio::adress


#define DEV_QUOTED_HELPER(s)   #s
#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_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_UNUSED   __attribute__((unused))


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::u8 = boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 8, 8, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >>
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 >
using dev::string32 = std::array< char, 32 >


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


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 ()
u256 dev::exp10< 0 > ()
template<typename T >
uint64_t dev::toUint64 (T _u)
 Converts given multiprecision number to standard number type. More...
template<typename T >
uint8_t dev::toUint8 (T _u)
template<class N >
dev::diff (N const &_a, N const &_b)
uint64_t dev::utcTime ()
 Get the current time in seconds since the epoch in UTC. More...
dev::WithExisting std::max (dev::WithExisting _a, dev::WithExisting _b)

Macro Definition Documentation

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

Definition at line 65 of file Common.h.

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

Definition at line 63 of file Common.h.

#define DEV_INVARIANT_CHECK   (void)0;

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

Definition at line 257 of file Common.h.

#define DEV_INVARIANT_CHECK_HERE   (void)0;

Definition at line 258 of file Common.h.

#define DEV_QUOTED (   s)    DEV_QUOTED_HELPER(s)

Definition at line 61 of file Common.h.

#define DEV_QUOTED_HELPER (   s)    #s

Definition at line 60 of file Common.h.

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

Definition at line 287 of file Common.h.

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

Definition at line 295 of file Common.h.


Definition at line 292 of file Common.h.


Definition at line 300 of file Common.h.

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

Definition at line 288 of file Common.h.

)    ::dev::TimerHelper __eth_t(S, MS)

Definition at line 296 of file Common.h.

#define DEV_UNUSED   __attribute__((unused))

Definition at line 307 of file Common.h.

Typedef Documentation

using byte = uint8_t

Definition at line 57 of file Common.h.