Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mutils::Bytes Struct Reference

#include <Bytes.hpp>

Inheritance diagram for mutils::Bytes:
Inheritance graph
[legend]
Collaboration diagram for mutils::Bytes:
Collaboration graph
[legend]

Public Member Functions

 Bytes (decltype(bytes) b, decltype(size) s)
 
std::size_t to_bytes (char *v) const
 Write this class's marshalled representation into the array found at v. More...
 
std::size_t bytes_size () const
 the size of the marshalled representation of this object. More...
 
void post_object (const std::function< void(char const *const, std::size_t)> &f) const
 Pass a pointer to a buffer containing this class's marshalled representation into the function f. More...
 
void ensure_registered (DeserializationManager &)
 
- Public Member Functions inherited from mutils::ByteRepresentable
virtual ~ByteRepresentable ()
 

Static Public Member Functions

template<typename T , typename V >
static std::unique_ptr< Bytesfrom_bytes (T *, V *)
 
static context_ptr< Bytesfrom_bytes_noalloc (DeserializationManager *, char const *const v)
 

Public Attributes

char const *const bytes
 
const std::size_t size
 

Detailed Description

Definition at line 12 of file Bytes.hpp.

Constructor & Destructor Documentation

◆ Bytes()

mutils::Bytes::Bytes ( decltype(bytes b,
decltype(size s 
)
inline

Definition at line 17 of file Bytes.hpp.

Member Function Documentation

◆ bytes_size()

std::size_t mutils::Bytes::bytes_size ( ) const
inlinevirtual

the size of the marshalled representation of this object.

useful when allocating arrays in which to store this object.

NOTE: it is recommended that users not call this directly, and prefer to use mutils::bytes_size(T,v) instead.

Implements mutils::ByteRepresentable.

Definition at line 26 of file Bytes.hpp.

◆ ensure_registered()

void mutils::Bytes::ensure_registered ( DeserializationManager )
inline

Definition at line 35 of file Bytes.hpp.

◆ from_bytes()

template<typename T , typename V >
static std::unique_ptr<Bytes> mutils::Bytes::from_bytes ( T *  ,
V *   
)
inlinestatic

Definition at line 39 of file Bytes.hpp.

◆ from_bytes_noalloc()

static context_ptr<Bytes> mutils::Bytes::from_bytes_noalloc ( DeserializationManager ,
char const *const  v 
)
inlinestatic

Definition at line 43 of file Bytes.hpp.

◆ post_object()

void mutils::Bytes::post_object ( const std::function< void(char const *const, std::size_t)> &  ) const
inlinevirtual

Pass a pointer to a buffer containing this class's marshalled representation into the function f.

This pointer is not guaranteed to live beyond the duration of the call to f, so make a copy if you need to keep it around.

NOTE: it is recommended that users not call this directly, and prefer to use mutils::post_object(f,T) instead.

Implements mutils::ByteRepresentable.

Definition at line 30 of file Bytes.hpp.

◆ to_bytes()

std::size_t mutils::Bytes::to_bytes ( char *  v) const
inlinevirtual

Write this class's marshalled representation into the array found at v.

assume v has at least bytes_size() of free memory available; behavior is undefined otherwise.

Returns number of bytes written, which should be the same as bytes_size().

NOTE: it is recommended that users not call this directly, and prefer to use mutils::to_bytes(T,v) instead.

Implements mutils::ByteRepresentable.

Definition at line 20 of file Bytes.hpp.

Member Data Documentation

◆ bytes

char const* const mutils::Bytes::bytes

Definition at line 14 of file Bytes.hpp.

◆ size

const std::size_t mutils::Bytes::size

Definition at line 15 of file Bytes.hpp.


The documentation for this struct was generated from the following file: