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" 34 PXR_NAMESPACE_OPEN_SCOPE
50 static std::shared_ptr<ArInMemoryAsset>
FromAsset(
56 static std::shared_ptr<ArInMemoryAsset>
FromBuffer(
57 const std::shared_ptr<const char>& buffer,
63 static std::shared_ptr<ArInMemoryAsset>
FromBuffer(
64 std::shared_ptr<const char>&& buffer,
74 size_t GetSize()
const override;
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;
110 PXR_NAMESPACE_CLOSE_SCOPE
AR_API ~ArInMemoryAsset()
Destructor.
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.
AR_API std::pair< FILE *, size_t > GetFileUnsafe() const override
Returns { nullptr, 0 } as this object is not associated with a file.
Interface for accessing the contents of an asset.
static AR_API std::shared_ptr< ArInMemoryAsset > FromAsset(const ArAsset &srcAsset)
Constructs a new instance containing the entire contents of srcAsset.
AR_API std::shared_ptr< const char > GetBuffer() const override
Returns the buffer managed by this object.
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.
ArAsset implementation that stores asset content in a heap-allocated 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.