HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
binary.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 #ifndef PXR_BASE_TS_BINARY_H
9 #define PXR_BASE_TS_BINARY_H
10 
11 #include "pxr/pxr.h"
12 #include "pxr/base/ts/api.h"
13 #include "pxr/base/ts/spline.h"
14 #include "pxr/base/ts/types.h"
15 #include "pxr/base/vt/dictionary.h"
16 
17 #include <vector>
18 #include <unordered_map>
19 #include <cstdint>
20 
22 
23 
24 // For writing splines to, and reading them from, binary files.
25 //
27 {
28 public:
29  // Get spline data version that is needed to write the given spline.
30  // 1: initial version.
31  // 2: added tangent algorithms None and AutoEase
32  TS_API
33  static uint8_t GetBinaryFormatVersion(const TsSpline& spline);
34 
35  // Write a spline to binary data. There are two outputs: a blob, and a
36  // customData map-of-dictionaries that consists of standard types.
37  TS_API
38  static void GetBinaryData(
39  const TsSpline &spline,
40  std::vector<uint8_t> *buf,
41  const std::unordered_map<TsTime, VtDictionary> **customDataOut);
42 
43  // Read a spline out of binary data.
44  TS_API
46  const std::vector<uint8_t> &buf,
47  std::unordered_map<TsTime, VtDictionary> &&customData);
48 
49 private:
50  static TsSpline _ParseV1_2(
51  uint8_t version,
52  const std::vector<uint8_t> &buf,
53  std::unordered_map<TsTime, VtDictionary> &&customData);
54 };
55 
56 
58 
59 #endif
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t) IMATH_NOEXCEPT
Definition: ImathQuat.h:621
static TS_API uint8_t GetBinaryFormatVersion(const TsSpline &spline)
static TS_API void GetBinaryData(const TsSpline &spline, std::vector< uint8_t > *buf, const std::unordered_map< TsTime, VtDictionary > **customDataOut)
#define TS_API
Definition: api.h:24
GT_API const UT_StringHolder version
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static TS_API TsSpline CreateSplineFromBinaryData(const std::vector< uint8_t > &buf, std::unordered_map< TsTime, VtDictionary > &&customData)