8 #ifndef PXR_USD_SDR_SHADER_NODE_QUERY_H
9 #define PXR_USD_SDR_SHADER_NODE_QUERY_H
65 typedef std::function<bool (SdrShaderNodeConstPtr)>
FilterFn;
135 template <
typename T>
144 const std::vector<VtValue>&
values);
156 template <
typename T>
166 const std::vector<VtValue>&
values);
192 std::vector<std::pair<TfToken, VtValue>> _hasValues;
193 std::vector<std::pair<TfToken, std::vector<VtValue>>> _hasOneOfValues;
194 std::vector<std::pair<TfToken, VtValue>> _lacksValues;
195 std::vector<std::pair<TfToken, std::vector<VtValue>>> _lacksAllOfValues;
196 std::vector<TfToken> _selectKeys;
197 std::vector<FilterFn> _customFilters;
224 const std::vector<std::vector<VtValue>>&
GetValues() const & {
return _values; }
228 return std::move(_values);
240 std::vector<std::vector<T>>
result;
241 result.reserve(_values.size());
242 for (
const std::vector<VtValue>&
row : _values) {
243 std::vector<T> convertedRows;
244 convertedRows.reserve(
row.size());
247 if (convertedValue.
IsEmpty()) {
249 "Failed to get value of type %s from value '%s'",
253 convertedRows.push_back(convertedValue);
255 result.push_back(convertedRows);
290 bool _IsValid()
const;
292 std::vector<TfToken> _keys;
293 std::vector<std::vector<VtValue>> _values;
294 std::vector<SdrShaderNodePtrVec> _nodes;
299 #endif // PXR_USD_SDR_SHADER_NODE_QUERY_H
SDR_API SdrShaderNodeQuery & NodeValueIsIn(const TfToken &key, const std::vector< VtValue > &values)
SDR_API SdrShaderNodeQuery & NodeHasValueFor(const TfToken &key)
#define PXR_NAMESPACE_OPEN_SCOPE
GLsizei const GLfloat * value
SDR_API SdrShaderNodeQuery & NodeValueIs(const TfToken &key, const VtValue &value)
**But if you need a result
bool IsEmpty() const
Returns true iff this value is empty.
std::vector< std::vector< T > > GetValuesAs() const
SdrShaderNodeConstPtrVec SdrShaderNodePtrVec
SDR_API SdrShaderNodeQuery & NodeValueIsNot(const TfToken &key, const VtValue &value)
SdrShaderNodeQuery & NodeValueIsNot(const TfToken &key, const T &value)
SdrShaderNodeQuery & NodeValueIs(const TfToken &key, const T &value)
std::string TfStringify(const T &v)
const std::vector< std::vector< VtValue > > & GetValues() const &
std::vector< TfToken > TfTokenVector
Convenience types.
GLuint const GLchar * name
SDR_API std::vector< SdrShaderNodePtrVec > GetShaderNodesByValues() const
const TfTokenVector & GetKeys() const &
SDR_API SdrShaderNodeQuery & NodeHasNoValueFor(const TfToken &key)
SDR_API SdrShaderNodeQuery & SelectDistinct(const TfToken &key)
GLenum GLsizei GLsizei GLint * values
std::function< bool(SdrShaderNodeConstPtr)> FilterFn
SDR_API SdrShaderNodeQuery & CustomFilter(FilterFn fn)
SDR_API SdrShaderNodePtrVec GetAllShaderNodes() const
#define PXR_NAMESPACE_CLOSE_SCOPE
OIIO_UTIL_API const char * c_str(string_view str)
std::vector< std::vector< VtValue > > GetValues()&&
Overload for rvalues, move out the values.
GLenum GLenum GLsizei void * row
SdrShaderNodeQueryResult stores the results of an SdrShaderNodeQuery.
TfTokenVector GetKeys()&&
Overload for rvalues, move out the keys.
SDR_API std::vector< std::vector< std::string > > GetStringifiedValues() const
Get string representations of all values, as provided by TfStringify.
SDR_API SdrShaderNodeQuery & NodeValueIsNotIn(const TfToken &key, const std::vector< VtValue > &values)
SDR_API SdrShaderNodeQueryResult Run()