CppWAMP
C++11 client library for the WAMP protocol
blob.hpp
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  Copyright Butterfly Energy Systems 2014-2015, 2022.
3  Distributed under the Boost Software License, Version 1.0.
4  http://www.boost.org/LICENSE_1_0.txt
5 ------------------------------------------------------------------------------*/
6 
7 #ifndef CPPWAMP_BLOB_HPP
8 #define CPPWAMP_BLOB_HPP
9 
10 //------------------------------------------------------------------------------
14 //------------------------------------------------------------------------------
15 
16 #include <cstdint>
17 #include <initializer_list>
18 #include <ostream>
19 #include <vector>
20 #include "api.hpp"
21 
22 namespace wamp
23 {
24 
25 //------------------------------------------------------------------------------
27 //------------------------------------------------------------------------------
28 class CPPWAMP_API Blob
29 {
30 public:
32  using Data = std::vector<uint8_t>;
33 
35  Blob();
36 
38  explicit Blob(Data data);
39 
41  explicit Blob(std::initializer_list<uint8_t> list);
42 
44  Data& data();
45 
47  const Data& data() const;
48 
50  bool operator==(const Blob& other) const;
51 
53  bool operator!=(const Blob& other) const;
54 
56  bool operator<(const Blob& other) const;
57 
58 private:
59  std::vector<uint8_t> data_;
60 };
61 
62 //------------------------------------------------------------------------------
65 //------------------------------------------------------------------------------
66 CPPWAMP_API std::ostream& operator<<(std::ostream& out, const Blob& blob);
67 
68 } // namespace wamp
69 
70 #ifndef CPPWAMP_COMPILED_LIB
71 #include "internal/blob.ipp"
72 #endif
73 
74 #endif // CPPWAMP_BLOB_HPP
wamp::Blob
Contains binary data as an array of bytes.
Definition: blob.hpp:28
api.hpp
Defines macros related to exporting/importing APIs.
wamp
Definition: anyhandler.hpp:36
wamp::Blob::Data
std::vector< uint8_t > Data
Array of bytes used to contain the binary data.
Definition: blob.hpp:32