23#ifndef PXR_USD_AR_IN_MEMORY_ASSET_H
24#define PXR_USD_AR_IN_MEMORY_ASSET_H
27#include "pxr/usd/ar/api.h"
34PXR_NAMESPACE_OPEN_SCOPE
57 const std::shared_ptr<const char>& buffer,
64 std::shared_ptr<const char>&& buffer,
78 std::shared_ptr<const char>
GetBuffer()
const override;
83 size_t Read(
void* buffer,
size_t count,
size_t offset)
const override;
95 struct PrivateCtorTag {};
99 template <
class BufferSharedPtr>
101 BufferSharedPtr&& buffer,
106 std::shared_ptr<const char> _buffer;
110PXR_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.