HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sdfTypeIndicator.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 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_USD_SDR_SDF_TYPE_INDICATOR_H
9 #define PXR_USD_SDR_SDF_TYPE_INDICATOR_H
10 
11 /// \file sdr/sdfTypeIndicator.h
12 
13 #include "pxr/pxr.h"
14 #include "pxr/usd/sdr/api.h"
15 #include "pxr/base/tf/token.h"
17 
19 
20 /// \class SdrSdfTypeIndicator
21 ///
22 /// Represents a mapping from an Sdr Property type to Sdf type.
23 ///
24 /// If an exact mapping exists from Sdr Property type to Sdf type, HasSdfType()
25 /// will return true, and GetSdfType() will return the Sdf type resulting from
26 /// the conversion. GetSdrType() will return the original Sdr Property type.
27 ///
28 /// If a mapping doesn't exist from Sdr Property type to Sdf type, HasSdfType()
29 /// will return false, and GetSdfType() will return either
30 /// SdfValueTypeNames->TokenArray or SdfValueTypeNames->Token. GetSdrType()
31 /// will return the original Sdr Property type.
33 {
34 public:
35  /// Default constructor.
36  SDR_API
38 
39  /// Constructor. The sdfType must be TokenArray or Token if hasSdfTypeMapping
40  /// is set to false.
41  SDR_API
43  const SdfValueTypeName& sdfType,
44  const TfToken& sdrType,
45  bool hasSdfTypeMapping = true);
46 
47  /// Gets the original Sdr property type associated with the represented
48  /// Sdr property type to Sdf type mapping.
49  SDR_API
50  TfToken GetSdrType() const;
51 
52  /// Whether an exact Sdf type exists for the represented Sdr property type
53  /// to Sdf type mapping.
54  SDR_API
55  bool HasSdfType() const;
56 
57  /// Gets the Sdf type associated with the represented Sdr property type to
58  /// Sdf type mapping. If there is no valid Sdf type, either
59  /// SdfValueTypeNames->TokenArray or SdfValueTypeNames->Token is returned.
60  SDR_API
62 
63  /// Equality operation
64  SDR_API
65  bool operator==(const SdrSdfTypeIndicator &rhs) const;
66 
67  /// Inequality operation
68  SDR_API
69  bool operator!=(const SdrSdfTypeIndicator &rhs) const;
70 
71 private:
72  SdfValueTypeName _sdfType;
73  TfToken _sdrType;
74  bool _hasSdfTypeMapping;
75 };
76 
78 
79 #endif // PXR_USD_SDR_SDF_TYPE_INDICATOR_H
SDR_API bool HasSdfType() const
SDR_API SdfValueTypeName GetSdfType() const
SDR_API SdrSdfTypeIndicator()
Default constructor.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
SDR_API bool operator!=(const SdrSdfTypeIndicator &rhs) const
Inequality operation.
SDR_API TfToken GetSdrType() const
Definition: token.h:70
SDR_API bool operator==(const SdrSdfTypeIndicator &rhs) const
Equality operation.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define SDR_API
Definition: api.h:23