github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/common/common.h (about)

     1  // Copyright (C) 2018 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or
     6  // modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // the go-nebulas library is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with the go-nebulas library.  If not, see
    18  // <http://www.gnu.org/licenses/>.
    19  //
    20  
    21  #pragma once
    22  
    23  #include "common/math/softfloat.hpp"
    24  #include <algorithm>
    25  #include <array>
    26  #include <boost/multiprecision/cpp_int.hpp>
    27  #include <boost/thread/shared_lock_guard.hpp>
    28  #include <boost/thread/shared_mutex.hpp>
    29  #include <cstdint>
    30  #include <glog/logging.h>
    31  #include <iostream>
    32  #include <memory>
    33  #include <mutex>
    34  #include <queue>
    35  #include <string>
    36  #include <thread>
    37  #include <tuple>
    38  #include <unordered_map>
    39  #include <unordered_set>
    40  #include <vector>
    41  
    42  namespace neb {
    43  
    44  typedef std::string hex_hash_t;
    45  typedef uint8_t byte_t;
    46  typedef uint64_t block_height_t;
    47  extern std::string program_name;
    48  
    49  typedef std::string module_t;
    50  typedef uint64_t version_t;
    51  typedef block_height_t start_block_t;
    52  typedef block_height_t end_block_t;
    53  
    54  typedef boost::multiprecision::int128_t int128_t;
    55  typedef boost::multiprecision::uint128_t uint128_t;
    56  typedef int128_t wei_t;
    57  
    58  typedef float32 floatxx_t;
    59  
    60  constexpr int32_t tx_status_fail = 0;
    61  constexpr int32_t tx_status_succ = 1;
    62  constexpr int32_t tx_status_special = 2; // only in the genesis block
    63  
    64  namespace tcolor {
    65  const static char *red = "\033[1;31m";
    66  const static char *green = "\033[1;32m";
    67  const static char *yellow = "\033[1;33m";
    68  const static char *blue = "\033[1;34m";
    69  const static char *magenta = "\033[1;35m";
    70  const static char *cyan = "\033[1;36m";
    71  const static char *reset = "\033[0m";
    72  }
    73  
    74  namespace ir_type {
    75  const static std::string llvm = "llvm";
    76  const static std::string cpp = "cpp";
    77  };
    78  }