6#ifndef PXR_USD_AR_IN_MEMORY_ASSET_H
7#define PXR_USD_AR_IN_MEMORY_ASSET_H
10#include "pxr/usd/ar/api.h"
17PXR_NAMESPACE_OPEN_SCOPE
40 const std::shared_ptr<const char>& buffer,
47 std::shared_ptr<const char>&& buffer,
61 std::shared_ptr<const char>
GetBuffer()
const override;
66 size_t Read(
void* buffer,
size_t count,
size_t offset)
const override;
78 struct PrivateCtorTag {};
82 template <
class BufferSharedPtr>
84 BufferSharedPtr&& buffer,
89 std::shared_ptr<const char> _buffer;
93PXR_NAMESPACE_CLOSE_SCOPE
Interface for accessing the contents of an asset.
ArAsset implementation that stores asset content in a heap-allocated buffer managed by this object.
AR_API std::shared_ptr< const char > GetBuffer() const override
Returns the buffer managed by this object.
AR_API size_t Read(void *buffer, size_t count, size_t offset) const override
Reads count bytes from the buffer held by this object at the given offset into buffer.
static AR_API std::shared_ptr< ArInMemoryAsset > FromBuffer(const std::shared_ptr< const char > &buffer, size_t bufferSize)
Constructs a new instance sharing ownership of the given buffer containing bufferSize bytes.
AR_API std::pair< FILE *, size_t > GetFileUnsafe() const override
Returns { nullptr, 0 } as this object is not associated with a file.
static AR_API std::shared_ptr< ArInMemoryAsset > FromAsset(const ArAsset &srcAsset)
Constructs a new instance containing the entire contents of srcAsset.
AR_API size_t GetSize() const override
Returns the size of the buffer managed by this object.
AR_API std::shared_ptr< ArAsset > GetDetachedAsset() const override
Returns a new ArInMemoryAsset instance that shares the same buffer as this object.
static AR_API std::shared_ptr< ArInMemoryAsset > FromBuffer(std::shared_ptr< const char > &&buffer, size_t bufferSize)
Constructs a new instance taking ownership of the given buffer containing bufferSize bytes.
AR_API ~ArInMemoryAsset()
Destructor.