8#ifndef PXR_USD_NDR_DECLARE_H
9#define PXR_USD_NDR_DECLARE_H
14#include "pxr/usd/ndr/api.h"
19#include <unordered_map>
20#include <unordered_set>
23PXR_NAMESPACE_OPEN_SCOPE
35inline const std::string&
36NdrGetIdentifierString(
const NdrIdentifier&
id) {
return id.GetString(); }
37typedef std::vector<NdrIdentifier> NdrIdentifierVec;
42typedef std::vector<TfToken> NdrTokenVec;
43typedef std::unordered_map<
TfToken, std::string,
49typedef std::unique_ptr<NdrProperty> NdrPropertyUniquePtr;
50typedef std::vector<NdrPropertyUniquePtr> NdrPropertyUniquePtrVec;
51typedef std::unordered_map<
TfToken, NdrPropertyConstPtr,
56typedef NdrNode const* NdrNodeConstPtr;
57typedef std::unique_ptr<NdrNode> NdrNodeUniquePtr;
58typedef std::vector<NdrNodeConstPtr> NdrNodeConstPtrVec;
59typedef std::vector<NdrNodeUniquePtr> NdrNodeUniquePtrVec;
62typedef std::vector<std::string> NdrStringVec;
63typedef std::pair<TfToken, TfToken> NdrOption;
64typedef std::vector<NdrOption> NdrOptionVec;
65typedef std::unordered_set<std::string> NdrStringSet;
72 NdrVersion() =
default;
77 NdrVersion(
int major,
int minor = 0);
81 NdrVersion(
const std::string& x);
86 NdrVersion GetAsDefault()
const
88 return NdrVersion(*
this,
true);
93 int GetMajor()
const {
return _major; }
96 int GetMinor()
const {
return _minor; }
99 bool IsDefault()
const {
return _isDefault; }
103 std::string GetString()
const;
107 std::string GetStringSuffix()
const;
111 std::size_t GetHash()
const
113 return (
static_cast<std::size_t
>(_major) << 32) +
114 static_cast<std::size_t
>(_minor);
119 explicit operator bool()
const
126 bool operator!()
const
128 return _major == 0 && _minor == 0;
133 friend bool operator==(
const NdrVersion& lhs,
const NdrVersion& rhs)
135 return lhs._major == rhs._major && lhs._minor == rhs._minor;
140 friend bool operator!=(
const NdrVersion& lhs,
const NdrVersion& rhs)
142 return !(lhs == rhs);
147 friend bool operator<(
const NdrVersion& lhs,
const NdrVersion& rhs)
149 return lhs._major < rhs._major ||
150 (lhs._major == rhs._major && lhs._minor < rhs._minor);
155 friend bool operator<=(
const NdrVersion& lhs,
const NdrVersion& rhs)
157 return lhs._major < rhs._major ||
158 (lhs._major == rhs._major && lhs._minor <= rhs._minor);
163 friend bool operator>(
const NdrVersion& lhs,
const NdrVersion& rhs)
165 return !(lhs <= rhs);
170 friend bool operator>=(
const NdrVersion& lhs,
const NdrVersion& rhs)
176 NdrVersion(
const NdrVersion& x,
bool)
177 : _major(x._major), _minor(x._minor), _isDefault(true) { }
180 int _major = 0, _minor = 0;
181 bool _isDefault =
false;
186 NdrVersionFilterDefaultOnly,
187 NdrVersionFilterAllVersions,
191PXR_NAMESPACE_CLOSE_SCOPE
Represents an abstract node.
Represents a property (input or output) that is part of a NdrNode instance.
Represents a value type name, i.e.
Token for efficient comparison, assignment, and hashing of known strings.
Functor to use for hash maps from tokens to other things.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
NdrVersionFilter
Enumeration used to select nodes by version.