All Classes Namespaces Functions Variables Typedefs Enumerations Friends
header.h
1 
5 #pragma once
6 
7 #include <array>
8 #include <string>
9 #include <vector>
10 
11 namespace ucxx {
12 
13 const size_t HeaderFramesSize =
14  100;
15 
23 class Header {
24  private:
32  void deserialize(const std::string& serializedHeader);
33 
34  public:
35  bool next;
36  size_t nframes;
37  std::array<int, HeaderFramesSize> isCUDA;
38  std::array<size_t, HeaderFramesSize> size;
39 
40  Header() = delete;
41 
62  Header(bool next, size_t nframes, int* isCUDA, size_t* size);
63 
71  explicit Header(std::string serializedHeader);
72 
81  [[nodiscard]] static size_t dataSize();
82 
90  [[nodiscard]] const std::string serialize() const;
91 
104  [[nodiscard]] static std::vector<Header> buildHeaders(const std::vector<size_t>& size,
105  const std::vector<int>& isCUDA);
106 };
107 
108 } // namespace ucxx
A serializable object containing metadata of multiple buffers.
Definition: header.h:23
static std::vector< Header > buildHeaders(const std::vector< size_t > &size, const std::vector< int > &isCUDA)
Convenience method to build headers given arbitrary-sized input.
size_t nframes
Number of frames.
Definition: header.h:36
std::array< int, HeaderFramesSize > isCUDA
Flag for whether each frame is CUDA or host.
Definition: header.h:37
Header(bool next, size_t nframes, int *isCUDA, size_t *size)
Constructor of a fixed-size header.
Header(std::string serializedHeader)
Constructor of a fixed-size header from serialized data.
const std::string serialize() const
Get the serialized data.
bool next
Whether there is a next header.
Definition: header.h:35
static size_t dataSize()
Get the size of the underlying data.
std::array< size_t, HeaderFramesSize > size
Size in bytes of each frame.
Definition: header.h:38
Definition: address.h:15
const size_t HeaderFramesSize
The number of buffers contained in a single ucxx::Header object.
Definition: header.h:13