Turi Create  4.0
turi::blob Class Reference

#include <core/generics/blob.hpp>

Public Member Functions

 blob ()
 user information More...
 
 blob (size_t new_size)
 
 blob (size_t osize, void *odata)
 
 blob (const blob &b)
 
template<typename T >
T & as ()
 
template<typename T >
const T & as () const
 
template<typename T >
T * as_ptr ()
 
template<typename T >
const T * as_ptr () const
 
size_t size () const
 
void * data ()
 
const void * data () const
 
void copy (size_t osize, void *odata)
 
void copy (const blob &other)
 
blob copy () const
 
void resize (size_t new_size)
 
void clear ()
 
void swap (blob &b)
 

Detailed Description

blob is the general representation of a "block" of information. . 'data' must be exactly 'length' bytes and must be entirely self contained. It must not hold references to other memory regions. That is to say, I should be able read off exactly 'length' bytes from 'data', and send it across a network/write it to a disk/etc, and the information should still be consistent The blob is self-managed and will free and delete the underlying memory when it goes out of scope.

Definition at line 29 of file blob.hpp.

Constructor & Destructor Documentation

◆ blob() [1/4]

turi::blob::blob ( )
inline

user information

Create an empty blob

Definition at line 35 of file blob.hpp.

◆ blob() [2/4]

turi::blob::blob ( size_t  new_size)
inline

Create simple blob of a certain size (with allocation)

Definition at line 38 of file blob.hpp.

◆ blob() [3/4]

turi::blob::blob ( size_t  osize,
void *  odata 
)
inline

Makes a copy of the ptr provided

Definition at line 44 of file blob.hpp.

◆ blob() [4/4]

turi::blob::blob ( const blob b)
inline

Copy constructor

Definition at line 49 of file blob.hpp.

Member Function Documentation

◆ as() [1/2]

template<typename T >
T& turi::blob::as ( )
inline

Smart Casting

Definition at line 59 of file blob.hpp.

◆ as() [2/2]

template<typename T >
const T& turi::blob::as ( ) const
inline

Smart Casting

Definition at line 67 of file blob.hpp.

◆ as_ptr() [1/2]

template<typename T >
T* turi::blob::as_ptr ( )
inline

Smart Casting

Definition at line 75 of file blob.hpp.

◆ as_ptr() [2/2]

template<typename T >
const T* turi::blob::as_ptr ( ) const
inline

Smart Casting

Definition at line 83 of file blob.hpp.

◆ clear()

void turi::blob::clear ( )
inline

free the memory associated with this blob

Definition at line 146 of file blob.hpp.

◆ copy() [1/3]

void turi::blob::copy ( size_t  osize,
void *  odata 
)
inline

make a copy of the data passed in as arguments.

Definition at line 108 of file blob.hpp.

◆ copy() [2/3]

void turi::blob::copy ( const blob other)
inline

Make "deep" copy of the blob by replicate its binary data

Definition at line 115 of file blob.hpp.

◆ copy() [3/3]

blob turi::blob::copy ( ) const
inline

deprecated. Just use operator=

Definition at line 124 of file blob.hpp.

◆ data() [1/2]

void* turi::blob::data ( )
inline

Get the size of the blob

Definition at line 93 of file blob.hpp.

◆ data() [2/2]

const void* turi::blob::data ( ) const
inline

Get the size of the blob

Definition at line 96 of file blob.hpp.

◆ resize()

void turi::blob::resize ( size_t  new_size)
inline

Resize the blob to any size including 0

Definition at line 128 of file blob.hpp.

◆ size()

size_t turi::blob::size ( ) const
inline

Get the size of the blob

Definition at line 90 of file blob.hpp.

◆ swap()

void turi::blob::swap ( blob b)
inline

Swaps the contents of two blobs. A "safe" version of a shallow copy

Definition at line 157 of file blob.hpp.


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