Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | List of all members
mutils::ByteRepresentable Struct Referenceabstract

A non-POD type which wishes to mark itself byte representable should extend this class. More...

#include <SerializationSupport.hpp>

Inheritance diagram for mutils::ByteRepresentable:
Inheritance graph
[legend]

Public Member Functions

virtual std::size_t to_bytes (char *v) const =0
 Write this class's marshalled representation into the array found at v. More...
 
virtual void post_object (const std::function< void(char const *const, std::size_t)> &) const =0
 Pass a pointer to a buffer containing this class's marshalled representation into the function f. More...
 
virtual std::size_t bytes_size () const =0
 the size of the marshalled representation of this object. More...
 
virtual ~ByteRepresentable ()
 

Detailed Description

A non-POD type which wishes to mark itself byte representable should extend this class.

Intended to use to convert classes to and from contiguous sequences of bytes.

Definition at line 24 of file SerializationSupport.hpp.

Constructor & Destructor Documentation

◆ ~ByteRepresentable()

virtual mutils::ByteRepresentable::~ByteRepresentable ( )
inlinevirtual

Definition at line 68 of file SerializationSupport.hpp.

Member Function Documentation

◆ bytes_size()

virtual std::size_t mutils::ByteRepresentable::bytes_size ( ) const
pure virtual

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.

Implemented in persistent::Persistent< ObjectType, storageType >, persistent::Persistent< ObjectType, ST_MEM >, persistent::Persistent< objectstore::DeltaObjectStoreCore >, mutils::marshalled, VariableBytes, objectstore::Blob, and mutils::Bytes.

◆ post_object()

virtual void mutils::ByteRepresentable::post_object ( const std::function< void(char const *const, std::size_t)> &  ) const
pure virtual

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.

Implemented in persistent::Persistent< ObjectType, storageType >, persistent::Persistent< ObjectType, ST_MEM >, persistent::Persistent< objectstore::DeltaObjectStoreCore >, objectstore::Blob, VariableBytes, and mutils::Bytes.

◆ to_bytes()

virtual std::size_t mutils::ByteRepresentable::to_bytes ( char *  v) const
pure virtual

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.

Implemented in persistent::Persistent< ObjectType, storageType >, persistent::Persistent< ObjectType, ST_MEM >, persistent::Persistent< objectstore::DeltaObjectStoreCore >, mutils::marshalled, objectstore::Blob, VariableBytes, and mutils::Bytes.


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