All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
asset.h
Go to the documentation of this file.
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_AR_ASSET_H
8#define PXR_USD_AR_ASSET_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/ar/ar.h"
14#include "pxr/usd/ar/api.h"
15
16#include <cstdio>
17#include <memory>
18#include <utility>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
27class ArAsset {
28public:
29 AR_API
30 virtual ~ArAsset();
31
32 ArAsset(const ArAsset&) = delete;
33 ArAsset& operator=(const ArAsset&) = delete;
34
36 AR_API
37 virtual size_t GetSize() const = 0;
38
47 AR_API
48 virtual std::shared_ptr<const char> GetBuffer() const = 0;
49
55 AR_API
56 virtual size_t Read(void* buffer, size_t count, size_t offset) const = 0;
57
75 AR_API
76 virtual std::pair<FILE*, size_t> GetFileUnsafe() const = 0;
77
85 AR_API
86 virtual std::shared_ptr<ArAsset> GetDetachedAsset() const;
87
88protected:
89 AR_API
90 ArAsset();
91};
92
93PXR_NAMESPACE_CLOSE_SCOPE
94
95#endif // PXR_USD_AR_ASSET_H
Interface for accessing the contents of an asset.
Definition: asset.h:27
virtual AR_API std::pair< FILE *, size_t > GetFileUnsafe() const =0
Returns a read-only FILE* handle and offset for this asset if available, or (nullptr,...
virtual AR_API size_t GetSize() const =0
Returns size of the asset.
virtual AR_API std::shared_ptr< ArAsset > GetDetachedAsset() const
Returns an ArAsset with the contents of this asset detached from from this asset's serialized data.
virtual AR_API size_t Read(void *buffer, size_t count, size_t offset) const =0
Read count bytes at offset from the beginning of the asset into buffer.
virtual AR_API std::shared_ptr< const char > GetBuffer() const =0
Returns a pointer to a buffer with the contents of the asset, with size given by GetSize().