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;
18  std::string toBinaryString(const Blob &b);
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  Bytes blob_;
76  std::string hex_;
77  };
78 
79  } // namespace crypto
80 } // namespace shared_model
81 #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
virtual const std::string & hex() const
Definition: blob.cpp:45
Blob * clone() const override
Definition: blob.cpp:26
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