All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
crateInfo.h
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_USD_CRATE_INFO_H
8#define PXR_USD_USD_CRATE_INFO_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/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
20PXR_NAMESPACE_OPEN_SCOPE
21
22
29{
30public:
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
49 USD_API
50 static UsdCrateInfo Open(std::string const &fileName);
51
53 USD_API
54 SummaryStats GetSummaryStats() const;
55
57 USD_API
58 std::vector<Section> GetSections() const;
59
61 USD_API
63
65 USD_API
67
69 explicit operator bool() const { return (bool)_impl; }
70
71private:
72
73 struct _Impl;
74 std::shared_ptr<_Impl> _impl;
75};
76
77
78PXR_NAMESPACE_CLOSE_SCOPE
79
80#endif // PXR_USD_USD_CRATE_INFO_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A class for introspecting the underlying qualities of .usdc 'crate' files, for diagnostic purposes.
Definition: crateInfo.h:29
USD_API std::vector< Section > GetSections() const
Return the named file sections, their location and sizes in the file.
USD_API SummaryStats GetSummaryStats() const
Return summary statistics structure for this file.
USD_API TfToken GetFileVersion() const
Return the file version.
static USD_API UsdCrateInfo Open(std::string const &fileName)
Attempt to open and read fileName.
USD_API TfToken GetSoftwareVersion() const
Return the software version.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...