24 #ifndef PXR_USD_SDF_VALUE_TYPE_REGISTRY_H
25 #define PXR_USD_SDF_VALUE_TYPE_REGISTRY_H
28 #include "pxr/usd/sdf/valueTypeName.h"
29 #include "pxr/base/tf/enum.h"
30 #include "pxr/base/tf/token.h"
31 #include "pxr/base/vt/array.h"
32 #include "pxr/base/vt/value.h"
33 #include <boost/noncopyable.hpp>
37 PXR_NAMESPACE_OPEN_SCOPE
45 class Sdf_ValueTypeRegistry : boost::noncopyable {
47 Sdf_ValueTypeRegistry();
48 ~Sdf_ValueTypeRegistry();
51 std::vector<SdfValueTypeName> GetAllTypes()
const;
91 const VtValue& defaultArrayValue)
93 , _defaultValue(defaultValue)
94 , _defaultArrayValue(defaultArrayValue)
100 Type(
char const *name,
const T& defaultValue)
113 Type& CPPTypeName(
const std::string& cppTypeName)
115 _cppTypeName = cppTypeName;
116 if (!_defaultArrayValue.IsEmpty()) {
117 _arrayCppTypeName =
"VtArray<" + cppTypeName +
">";
124 { _dimensions = dims;
return *
this; }
127 Type& DefaultUnit(
TfEnum unit) { _unit = unit;
return *
this; }
130 Type& Role(
const TfToken& role) { _role = role;
return *
this; }
135 _defaultArrayValue =
VtValue();
136 _arrayCppTypeName = std::string();
141 friend class Sdf_ValueTypeRegistry;
145 VtValue _defaultValue, _defaultArrayValue;
146 std::string _cppTypeName, _arrayCppTypeName;
154 void AddType(
const Type& type);
157 void AddType(
const TfToken& name,
159 const VtValue& defaultArrayValue,
160 const std::string& cppName,
const std::string& cppArrayName,
168 void AddType(
const TfToken& name,
170 const std::string& cppName,
const std::string& cppArrayName,
180 std::unique_ptr<_Impl> _impl;
183 PXR_NAMESPACE_CLOSE_SCOPE
185 #endif // PXR_USD_SDF_VALUE_TYPE_REGISTRY_H
An enum class that records both enum type and enum value.
Represents a value type name, i.e.
Token for efficient comparison, assignment, and hashing of known strings.
Represents an arbitrary dimensional rectangular container class.
TfType represents a dynamic runtime type.
Represents the shape of a value type (or that of an element in an array).
Provides a container which may hold any type, and provides introspection and iteration over array typ...