This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
dynamicFileFormatDependencyData.h
1//
2// Copyright 2019 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_USD_PCP_DYNAMIC_FILE_FORMAT_DEPENDENCY_DATA_H
8#define PXR_USD_PCP_DYNAMIC_FILE_FORMAT_DEPENDENCY_DATA_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/pcp/api.h"
13#include "pxr/base/tf/token.h"
14
15#include <memory>
16#include <vector>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
21class VtValue;
22
24
34{
35public:
37 PCP_API
39
41 PCP_API
44
46 PCP_API
49
53 Swap(rhs);
54 return *this;
55 }
56
61 return *this;
62 }
63
66 _data.swap(rhs._data);
67 }
68
70 inline void swap(PcpDynamicFileFormatDependencyData &rhs) { Swap(rhs); }
71
73 inline bool IsEmpty() const {
74 return !_data;
75 }
76
83 PCP_API
85 const PcpDynamicFileFormatInterface *dynamicFileFormat,
86 VtValue &&dependencyContextData,
87 TfToken::Set &&composedFieldNames,
88 TfToken::Set &&composedAttributeNames);
89
92 PCP_API
94 PcpDynamicFileFormatDependencyData &&dependencyData);
95
98 PCP_API
100
103 PCP_API
105
110 PCP_API
112 const TfToken &fieldName,
113 const VtValue& oldValue,
114 const VtValue& newValue) const;
115
120 PCP_API
122 const TfToken &attributeName,
123 const VtValue &oldValue,
124 const VtValue &newValue) const;
125
126private:
127 // Struct containing the entire contents of the dependency.
128 struct _Data
129 {
130 using _ContextData =
131 std::pair<const PcpDynamicFileFormatInterface *, VtValue>;
132 using _ContextDataVector = std::vector<_ContextData>;
133
134 _ContextDataVector dependencyContexts;
135 TfToken::Set relevantFieldNames;
136 TfToken::Set relevantAttributeNames;
137
138 // Helper for adding relevant fields. We avoid copying by taking the
139 // input set if our set is empty.
140 void _AddRelevantFieldNames(TfToken::Set &&fieldNames);
141
142 // Helper for adding relevant attributes. We avoid copying by taking the
143 // input set if our set is empty.
144 void _AddRelevantAttributeNames(TfToken::Set &&attributeNames);
145 };
146
147 // Pointer to data. Will be null if this an empty data object.
148 std::unique_ptr<_Data> _data;
149};
150
151PXR_NAMESPACE_CLOSE_SCOPE
152
153#endif // PXR_USD_PCP_DYNAMIC_FILE_FORMAT_DEPENDENCY_DATA_H
Contains the necessary information for storing a prim index's dependency on dynamic file format argum...
PCP_API PcpDynamicFileFormatDependencyData(PcpDynamicFileFormatDependencyData &&)=default
Move constructor.
void swap(PcpDynamicFileFormatDependencyData &rhs)
Same as Swap(), but standard name.
PCP_API const TfToken::Set & GetRelevantFieldNames() const
Returns a list of field names that were composed for any of the dependency contexts that were added t...
PCP_API void AppendDependencyData(PcpDynamicFileFormatDependencyData &&dependencyData)
Takes all the dependency data from dependencyData and adds it to this dependency.
PCP_API bool CanAttributeDefaultValueChangeAffectFileFormatArguments(const TfToken &attributeName, const VtValue &oldValue, const VtValue &newValue) const
Given an attributeName and the changed attribute default values in oldValue and newValue,...
PCP_API bool CanFieldChangeAffectFileFormatArguments(const TfToken &fieldName, const VtValue &oldValue, const VtValue &newValue) const
Given a field name and the changed field values in oldValue and newValue, this returns whether this c...
bool IsEmpty() const
Returns whether this dependency data is empty.
PcpDynamicFileFormatDependencyData & operator=(const PcpDynamicFileFormatDependencyData &rhs)
Copy assignment operator.
PCP_API void AddDependencyContext(const PcpDynamicFileFormatInterface *dynamicFileFormat, VtValue &&dependencyContextData, TfToken::Set &&composedFieldNames, TfToken::Set &&composedAttributeNames)
Adds dependency info from a single context that generated dynamic file format arguments (usually a pa...
void Swap(PcpDynamicFileFormatDependencyData &rhs)
Swap the contents of this dependency data with rhs.
PCP_API PcpDynamicFileFormatDependencyData(const PcpDynamicFileFormatDependencyData &rhs)
Copy constructor.
PCP_API const TfToken::Set & GetRelevantAttributeNames() const
Returns a list of attribute names that were composed for any of the dependency contexts that were add...
PCP_API PcpDynamicFileFormatDependencyData()=default
Default constructor. This data will be empty.
PcpDynamicFileFormatDependencyData & operator=(PcpDynamicFileFormatDependencyData &&rhs)
Move assignment operator.
Interface mixin that can be included by SdfFileFormat subclasses to enable dynamic file format argume...
Base class for file format implementations.
Definition: fileFormat.h:50
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
std::set< TfToken, TfTokenFastArbitraryLessThan > Set
Predefined type for set of tokens, for when faster lookup is desired, without paying the memory or in...
Definition: token.h:166
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
Standard pointer typedefs.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:45
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...