Loading...
Searching...
No Matches
inputSpec.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#ifndef PXR_EXEC_VDF_INPUT_SPEC_H
8#define PXR_EXEC_VDF_INPUT_SPEC_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/vdf/api.h"
15
17#include "pxr/base/tf/token.h"
18#include "pxr/base/tf/type.h"
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22class VdfOutputSpec;
23
30{
31public:
32 TF_MALLOC_TAG_NEW("Vdf", "new VdfInputSpec");
33
35 enum Access {
36 READ = 0x1,
37 READWRITE = 0x2
38 };
39
40 template <typename T>
41 static VdfInputSpec *New(
42 const TfToken &inName,
43 const TfToken &outName,
44 Access access,
45 bool prerequisite)
46 {
47 return new VdfInputSpec(
48 TfType::Find<T>(), inName, outName, access, prerequisite);
49 }
50
51 static VdfInputSpec *New(
52 TfType type,
53 const TfToken &inName,
54 const TfToken &outName,
55 Access access,
56 bool prerequisite)
57 {
58 return new VdfInputSpec(type, inName, outName, access, prerequisite);
59 }
60
61 VDF_API
63
65 TfType GetType() const { return _type; }
66
68 const TfToken &GetName() const { return _name; }
69
71 VDF_API
72 std::string GetTypeName() const;
73
75 const Access &GetAccess() const { return _access; }
76
79 VDF_API
80 bool TypeMatches(const VdfOutputSpec &other) const;
81
86 return _associatedOutputName;
87 }
88
96 bool IsPrerequisite() const { return _prerequisite; }
97
99 VDF_API
100 size_t GetHash() const;
101
104 bool operator==(const VdfInputSpec &rhs) const {
105 return _type == rhs._type &&
106 _name == rhs._name &&
107 _associatedOutputName == rhs._associatedOutputName &&
108 _access == rhs._access &&
109 _prerequisite == rhs._prerequisite;
110 }
111 bool operator!=(const VdfInputSpec &rhs) const {
112 return !(*this == rhs);
113 }
114
115private:
117 TfType type,
118 const TfToken &inName,
119 const TfToken &outName,
120 Access access,
121 bool prerequisite)
122 : _type(type),
123 _name(inName),
124 _associatedOutputName(outName),
125 _access(access),
126 _prerequisite(prerequisite)
127 {}
128
129private:
130 // The type accepted by the input.
131 TfType _type;
132
133 // The name of the connector
134 TfToken _name;
135
136 // Access to the connector is limited by this value.
137 TfToken _associatedOutputName;
138
139 // Access to the connector is limited by this value.
140 Access _access;
141
142 // Whether or not this connector is a prerequisite connector.
143 bool _prerequisite;
144};
145
146PXR_NAMESPACE_CLOSE_SCOPE
147
148#endif
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
A VdfInputSpec describes an input connector.
Definition: inputSpec.h:30
const TfToken & GetAssociatedOutputName() const
Returns the name of the associated output, if any.
Definition: inputSpec.h:85
VDF_API size_t GetHash() const
Returns a hash for this instance.
VDF_API bool TypeMatches(const VdfOutputSpec &other) const
Returns true if this connector spec and other have the same type and false otherwise.
bool IsPrerequisite() const
Returns whether or not this connector is a prerequisite connector.
Definition: inputSpec.h:96
TfType GetType() const
Returns the type of this spec.
Definition: inputSpec.h:65
Access
Access limits the kinds of operations allowed on the connector.
Definition: inputSpec.h:35
VDF_API std::string GetTypeName() const
Returns the name of this spec's type.
const Access & GetAccess() const
Returns the access of this connector.
Definition: inputSpec.h:75
bool operator==(const VdfInputSpec &rhs) const
Returns true, if two input specs are equal.
Definition: inputSpec.h:104
const TfToken & GetName() const
Returns the name of this connector.
Definition: inputSpec.h:68
A VdfOuptutSpec describes an output connector.
Definition: outputSpec.h:40
#define TF_MALLOC_TAG_NEW(name1, name2)
Enable lib/tf memory management.
Definition: mallocTag.h:475
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...