hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
blob.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SHARED_MODEL_BLOB_HPP
7 #define IROHA_SHARED_MODEL_BLOB_HPP
8 
9 #include <string>
10 #include <vector>
11 
13 
14 namespace shared_model {
15  namespace crypto {
16 
17  class Blob;
19 
24  class Blob : public interface::ModelPrimitive<Blob> {
25  public:
26  using Bytes = std::vector<uint8_t>;
27 
28  Blob() = default;
33  explicit Blob(const std::string &blob);
34 
39  explicit Blob(const Bytes &blob);
40 
41  explicit Blob(Bytes &&blob) noexcept;
42 
49  static Blob fromHexString(const std::string &hex);
50 
54  virtual const Bytes &blob() const;
55 
60  virtual const std::string &hex() const;
61 
65  virtual size_t size() const;
66 
67  std::string toString() const override;
68 
69  bool operator==(const Blob &rhs) const override;
70 
71  protected:
72  Blob *clone() const override;
73 
74  private:
75  // TODO: 17/11/2017 luckychess use improved Lazy with references support
76  Bytes blob_;
77  std::string hex_;
78  };
79 
80  } // namespace crypto
81 } // namespace shared_model
82 #endif // IROHA_SHARED_MODEL_BLOB_HPP
std::vector< uint8_t > Bytes
Definition: blob.hpp:26
Definition: blob.hpp:24
std::string toString() const override
Definition: blob.cpp:53
Definition: peer.hpp:48
string(REPLACE".""/"CMAKE_SWIG_OUTDIR ${SWIG_JAVA_PKG}) else() set(CMAKE_SWIG_FLAGS"") endif() myswig_add_library(irohajava LANGUAGE java SOURCES bindings.i) unset(CMAKE_SWIG_FLAGS) swig_link_libraries(irohajava $
Definition: CMakeLists.txt:54
virtual const std::string & hex() const
Definition: blob.cpp:45
Blob * clone() const override
Definition: blob.cpp:26
std::vector< uint8_t > Blob
Definition: client_api.hpp:13
Definition: model_primitive.hpp:23
virtual size_t size() const
Definition: blob.cpp:49
static Blob fromHexString(const std::string &hex)
Definition: blob.cpp:34
virtual const Bytes & blob() const
Definition: blob.cpp:41
Definition: command_executor.hpp:12
std::string toBinaryString(const Blob &b)
Definition: blob.cpp:13