HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
writableAsset.h
Go to the documentation of this file.
1 //
2 // Copyright 2020 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_WRITABLE_ASSET_H
8 #define PXR_USD_AR_WRITABLE_ASSET_H
9 
10 /// \file ar/writableAsset.h
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/usd/ar/api.h"
15 
16 #include <cstdio>
17 
19 
20 /// \class ArWritableAsset
21 ///
22 /// Interface for writing data to an asset.
23 ///
24 /// \see ArResolver::OpenAssetForWrite for how to retrieve instances of
25 /// this object.
27 {
28 public:
29  AR_API
30  virtual ~ArWritableAsset();
31 
32  ArWritableAsset(const ArWritableAsset&) = delete;
33  ArWritableAsset& operator=(const ArWritableAsset&) = delete;
34 
35  /// Close this asset, performing any necessary finalization or commits
36  /// of data that was previously written. Returns true on success, false
37  /// otherwise.
38  ///
39  /// If successful, reads to the written asset in the same process should
40  /// reflect the fully written state by the time this function returns.
41  /// Also, further calls to any functions on this interface are invalid.
42  virtual bool Close() = 0;
43 
44  /// Writes \p count bytes from \p buffer at \p offset from the beginning
45  /// of the asset. Returns number of bytes written, or 0 on error.
46  virtual size_t Write(const void* buffer, size_t count, size_t offset) = 0;
47 
48 protected:
49  AR_API
51 };
52 
54 
55 #endif
AR_API ArWritableAsset()
#define AR_API
Definition: api.h:23
GLuint buffer
Definition: glcorearb.h:660
GLintptr offset
Definition: glcorearb.h:665
ArWritableAsset & operator=(const ArWritableAsset &)=delete
virtual AR_API ~ArWritableAsset()
virtual size_t Write(const void *buffer, size_t count, size_t offset)=0
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual bool Close()=0
GLint GLsizei count
Definition: glcorearb.h:405