Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::DataView Class Reference

An immutable object that encapsulates a pointer to a constant contiguous block of memory representing arbitrary binary data and a count of the number of bytes of data. More...

#include <bond/types/dataview.h>

Public Member Functions

 DataView ()
 Constructs an empty DataView. After construction, GetData() returns nullptr and GetLength() returns 0. More...
 
 DataView (const void *data, size_t length)
 Constructs a DataView over the given pointer to a block of memory. More...
 
 DataView (const DataView &other)=default
 
bool operator== (const DataView &other) const
 Returns whether this DataView points to the same number of bytes at the same memory address as another DataView. More...
 
const void * GetData () const
 Returns the pointer to the block of memory over which the view has been created. More...
 
size_t GetLength () const
 Returns the number of bytes of data in the view. More...
 

Detailed Description

An immutable object that encapsulates a pointer to a constant contiguous block of memory representing arbitrary binary data and a count of the number of bytes of data.

DataView does not perform any allocations; it contains a pointer to an existing block of memory whose lifetime must supersede that of the DataView.

Constructor & Destructor Documentation

◆ DataView() [1/3]

Bond::DataView::DataView ( )
inline

Constructs an empty DataView. After construction, GetData() returns nullptr and GetLength() returns 0.

◆ DataView() [2/3]

Bond::DataView::DataView ( const void *  data,
size_t  length 
)
inline

Constructs a DataView over the given pointer to a block of memory.

Parameters
dataThe pointer to a block of memory over which the view is created.
lengthThe number of bytes of data.

◆ DataView() [3/3]

Bond::DataView::DataView ( const DataView other)
default

Member Function Documentation

◆ GetData()

const void * Bond::DataView::GetData ( ) const
inline

Returns the pointer to the block of memory over which the view has been created.

◆ GetLength()

size_t Bond::DataView::GetLength ( ) const
inline

Returns the number of bytes of data in the view.

◆ operator==()

bool Bond::DataView::operator== ( const DataView other) const
inline

Returns whether this DataView points to the same number of bytes at the same memory address as another DataView.

Parameters
otherThe DataView against which this one is compared.

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