LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::Blob Class Reference

CPU read-only buffer of arbitrary size. More...

#include <Blob.h>

Inheritance diagram for LLGL::Blob:
LLGL::NonCopyable

Public Member Functions

 Blob ()
 Construcst an empty blob.
 Blob (Blob &&rhs) noexcept
 Move constructor.
Blob & operator= (Blob &&rhs) noexcept
 Move operator.
 Blob (const void *data, std::size_t size, bool isWeakRef=false)
 Constructs the blob with a copy of the specified data or a weak reference to the data.
 ~Blob ()
 Deletes the internal memory blob.
const void * GetData () const
 Returns a constant pointer to the internal buffer or null if this is a default initialized blob.
std::size_t GetSize () const
 Returns the size (in bytes) of the internal buffer or zero if this is a default initialized blob.
 operator bool () const
 Returns true if this blob is non-empty.
Public Member Functions inherited from LLGL::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
virtual ~NonCopyable ()=default

Static Public Member Functions

static Blob CreateCopy (const Blob &other)
 Creates a new BLob instance with a copy of the specified blob data.
static Blob CreateCopy (const void *data, std::size_t size)
 Creates a new Blob instance with a copy of the specified data.
static Blob CreateWeakRef (const void *data, std::size_t size)
 Creates a new Blob instance with a weak reference to the specified data.
static Blob CreateStrongRef (DynamicByteArray &&cont)
 Creates a new Blob instance with a strong reference to the specified byte array container.
static Blob CreateStrongRef (std::vector< char > &&cont)
 Creates a new Blob instance with a strong reference to the specified vector container.
static Blob CreateStrongRef (std::string &&str)
 Creates a new Blob instance with a strong reference to the specified string container.
static Blob CreateFromFile (const char *filename)
 Creates a new Blob instance with the data read from the specified binary file.
static Blob CreateFromFile (const std::string &filename)
 Creates a new Blob instance with the data read from the specified binary file.

Additional Inherited Members

Protected Member Functions inherited from LLGL::NonCopyable
 NonCopyable ()=default

Detailed Description

CPU read-only buffer of arbitrary size.

See also
RenderSystem::CreatePipelineState

Constructor & Destructor Documentation

◆ Blob() [1/3]

LLGL::Blob::Blob ( )

Construcst an empty blob.

◆ Blob() [2/3]

LLGL::Blob::Blob ( Blob && rhs)
noexcept

Move constructor.

◆ Blob() [3/3]

LLGL::Blob::Blob ( const void * data,
std::size_t size,
bool isWeakRef = false )

Constructs the blob with a copy of the specified data or a weak reference to the data.

Parameters
[in]dataRaw pointer to the data this blob is meant to take care of.
[in]sizeSpecifies the size (in bytes) of the memory data pointer to.
[in]isWeakRefIf this is true, this blob only references the data but does not copy it. In this case, the caller is responsible for managing the lifetime of the data and it must remain valid until the end of this blob. By default false.

◆ ~Blob()

LLGL::Blob::~Blob ( )

Deletes the internal memory blob.

Member Function Documentation

◆ CreateCopy() [1/2]

Blob LLGL::Blob::CreateCopy ( const Blob & other)
static

Creates a new BLob instance with a copy of the specified blob data.

◆ CreateCopy() [2/2]

Blob LLGL::Blob::CreateCopy ( const void * data,
std::size_t size )
static

Creates a new Blob instance with a copy of the specified data.

Parameters
[in]dataPointer to the data that is to be copied and managed by this blob.
[in]sizeSpecifies the size (in bytes) of the data.
Returns
New instance of Blob that manages the memory that is copied.

◆ CreateFromFile() [1/2]

Blob LLGL::Blob::CreateFromFile ( const char * filename)
static

Creates a new Blob instance with the data read from the specified binary file.

Parameters
[in]filenameSpecifies the file that is to be read.
Returns
New instance of Blob that manages the memory of a content copy from the specified file or null if the file could not be read.

◆ CreateFromFile() [2/2]

Blob LLGL::Blob::CreateFromFile ( const std::string & filename)
static

Creates a new Blob instance with the data read from the specified binary file.

Parameters
[in]filenameSpecifies the file that is to be read.
Returns
New instance of Blob that manages the memory of a content copy from the specified file or null if the file could not be read.

◆ CreateStrongRef() [1/3]

Blob LLGL::Blob::CreateStrongRef ( DynamicByteArray && cont)
static

Creates a new Blob instance with a strong reference to the specified byte array container.

Parameters
[in]contSpecifies the container whose data is to be moved into this Blob instance.
Returns
New instance of Blob that manages the specified unique pointer.

◆ CreateStrongRef() [2/3]

Blob LLGL::Blob::CreateStrongRef ( std::string && str)
static

Creates a new Blob instance with a strong reference to the specified string container.

Parameters
[in]strSpecifies the container whose data is to be moved into this Blob instance.
Returns
New instance of Blob that manages the specified container.

◆ CreateStrongRef() [3/3]

Blob LLGL::Blob::CreateStrongRef ( std::vector< char > && cont)
static

Creates a new Blob instance with a strong reference to the specified vector container.

Parameters
[in]contSpecifies the container whose data is to be moved into this Blob instance.
Returns
New instance of Blob that manages the specified container.

◆ CreateWeakRef()

Blob LLGL::Blob::CreateWeakRef ( const void * data,
std::size_t size )
static

Creates a new Blob instance with a weak reference to the specified data.

Parameters
[in]dataPointer to the data that is to be referenced. This pointer must remain valid for the lifetime of this Blob instance.
[in]sizeSpecifies the size (in bytes) of the data.
Returns
New instance of Blob that refers to the specified memory.

◆ GetData()

const void * LLGL::Blob::GetData ( ) const

Returns a constant pointer to the internal buffer or null if this is a default initialized blob.

◆ GetSize()

std::size_t LLGL::Blob::GetSize ( ) const

Returns the size (in bytes) of the internal buffer or zero if this is a default initialized blob.

◆ operator bool()

LLGL::Blob::operator bool ( ) const

Returns true if this blob is non-empty.

◆ operator=()

Blob & LLGL::Blob::operator= ( Blob && rhs)
noexcept

Move operator.


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