HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArInMemoryAsset Class Reference

#include <inMemoryAsset.h>

+ Inheritance diagram for ArInMemoryAsset:

Public Member Functions

AR_API ~ArInMemoryAsset ()
 
AR_API size_t GetSize () const override
 Returns the size of the buffer managed by this object. More...
 
AR_API std::shared_ptr< const
char > 
GetBuffer () const override
 Returns the buffer managed by this object. More...
 
AR_API size_t Read (void *buffer, size_t count, size_t offset) const override
 
AR_API std::pair< FILE *, size_t > GetFileUnsafe () const override
 Returns { nullptr, 0 } as this object is not associated with a file. More...
 
AR_API std::shared_ptr< ArAssetGetDetachedAsset () const override
 
template<class BufferSharedPtr >
 ArInMemoryAsset (BufferSharedPtr &&buffer, size_t bufferSize, PrivateCtorTag)
 
- Public Member Functions inherited from ArAsset
virtual AR_API ~ArAsset ()
 
 ArAsset (const ArAsset &)=delete
 
ArAssetoperator= (const ArAsset &)=delete
 

Static Public Member Functions

static AR_API std::shared_ptr
< ArInMemoryAsset
FromAsset (const ArAsset &srcAsset)
 
static AR_API std::shared_ptr
< ArInMemoryAsset
FromBuffer (const std::shared_ptr< const char > &buffer, size_t bufferSize)
 
static AR_API std::shared_ptr
< ArInMemoryAsset
FromBuffer (std::shared_ptr< const char > &&buffer, size_t bufferSize)
 

Additional Inherited Members

- Protected Member Functions inherited from ArAsset
AR_API ArAsset ()
 

Detailed Description

ArAsset implementation that stores asset content in a heap-allocated buffer managed by this object.

Definition at line 40 of file inMemoryAsset.h.

Constructor & Destructor Documentation

AR_API ArInMemoryAsset::~ArInMemoryAsset ( )

Destructor. Note that this may not destroy the associated buffer if a client is holding on to the result of GetBuffer().

template<class BufferSharedPtr >
ArInMemoryAsset::ArInMemoryAsset ( BufferSharedPtr &&  buffer,
size_t  bufferSize,
PrivateCtorTag   
)

Member Function Documentation

static AR_API std::shared_ptr<ArInMemoryAsset> ArInMemoryAsset::FromAsset ( const ArAsset srcAsset)
static

Constructs a new instance containing the entire contents of srcAsset.

Returns nullptr if a buffer large enough to hold srcAsset's contents cannot be allocated or if an error occurs when reading srcAsset's contents into the buffer.

static AR_API std::shared_ptr<ArInMemoryAsset> ArInMemoryAsset::FromBuffer ( const std::shared_ptr< const char > &  buffer,
size_t  bufferSize 
)
static

Constructs a new instance sharing ownership of the given buffer containing bufferSize bytes.

static AR_API std::shared_ptr<ArInMemoryAsset> ArInMemoryAsset::FromBuffer ( std::shared_ptr< const char > &&  buffer,
size_t  bufferSize 
)
static

Constructs a new instance taking ownership of the given buffer containing bufferSize bytes.

AR_API std::shared_ptr<const char> ArInMemoryAsset::GetBuffer ( ) const
overridevirtual

Returns the buffer managed by this object.

Implements ArAsset.

AR_API std::shared_ptr<ArAsset> ArInMemoryAsset::GetDetachedAsset ( ) const
overridevirtual

Returns a new ArInMemoryAsset instance that shares the same buffer as this object.

Reimplemented from ArAsset.

AR_API std::pair<FILE*, size_t> ArInMemoryAsset::GetFileUnsafe ( ) const
overridevirtual

Returns { nullptr, 0 } as this object is not associated with a file.

Implements ArAsset.

AR_API size_t ArInMemoryAsset::GetSize ( ) const
overridevirtual

Returns the size of the buffer managed by this object.

Implements ArAsset.

AR_API size_t ArInMemoryAsset::Read ( void buffer,
size_t  count,
size_t  offset 
) const
overridevirtual

Reads count bytes from the buffer held by this object at the given offset into buffer.

Implements ArAsset.


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