HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
crateInfo.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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_SDF_CRATE_INFO_H
8 #define PXR_USD_SDF_CRATE_INFO_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/sdf/api.h"
12 #include "pxr/base/tf/token.h"
13 
14 #include <cstddef>
15 #include <cstdint>
16 #include <memory>
17 #include <string>
18 #include <vector>
19 
21 
22 
23 /// \class SdfCrateInfo
24 ///
25 /// A class for introspecting the underlying qualities of .usdc 'crate' files,
26 /// for diagnostic purposes.
27 ///
29 {
30 public:
31  struct Section {
32  Section() = default;
33  Section(std::string const &name, int64_t start, int64_t size)
34  : name(name), start(start), size(size) {}
35  std::string name;
36  int64_t start = -1, size = -1;
37  };
38 
39  struct SummaryStats {
40  size_t numSpecs = 0;
41  size_t numUniquePaths = 0;
42  size_t numUniqueTokens = 0;
43  size_t numUniqueStrings = 0;
44  size_t numUniqueFields = 0;
45  size_t numUniqueFieldSets = 0;
46  };
47 
48  /// Attempt to open and read \p fileName.
49  SDF_API
50  static SdfCrateInfo Open(std::string const &fileName);
51 
52  /// Return summary statistics structure for this file.
53  SDF_API
55 
56  /// Return the named file sections, their location and sizes in the file.
57  SDF_API
58  std::vector<Section> GetSections() const;
59 
60  /// Return the file version.
61  SDF_API
62  TfToken GetFileVersion() const;
63 
64  /// Return the software version.
65  SDF_API
67 
68  /// Return true if this object refers to a valid file.
69  explicit operator bool() const { return (bool)_impl; }
70 
71 private:
72 
73  struct _Impl;
74  std::shared_ptr<_Impl> _impl;
75 };
76 
77 
79 
80 #endif // PXR_USD_SDF_CRATE_INFO_H
static SDF_API SdfCrateInfo Open(std::string const &fileName)
Attempt to open and read fileName.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLuint start
Definition: glcorearb.h:475
OutGridT const XformOp bool bool
Definition: token.h:70
SDF_API TfToken GetSoftwareVersion() const
Return the software version.
SDF_API TfToken GetFileVersion() const
Return the file version.
SDF_API std::vector< Section > GetSections() const
Return the named file sections, their location and sizes in the file.
GLuint const GLchar * name
Definition: glcorearb.h:786
SDF_API SummaryStats GetSummaryStats() const
Return summary statistics structure for this file.
#define SDF_API
Definition: api.h:23
GLsizeiptr size
Definition: glcorearb.h:664
Section(std::string const &name, int64_t start, int64_t size)
Definition: crateInfo.h:33
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::string name
Definition: crateInfo.h:35