Loading...
Searching...
No Matches
dynamicFileFormatDependencyData.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_PCP_DYNAMIC_FILE_FORMAT_DEPENDENCY_DATA_H
25#define PXR_USD_PCP_DYNAMIC_FILE_FORMAT_DEPENDENCY_DATA_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/pcp/api.h"
30#include "pxr/base/tf/token.h"
31
32#include <memory>
33#include <vector>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
38class VtValue;
39
41
51{
52public:
54 PCP_API
56
58 PCP_API
61
63 PCP_API
66
70 Swap(rhs);
71 return *this;
72 }
73
78 return *this;
79 }
80
83 _data.swap(rhs._data);
84 }
85
87 inline void swap(PcpDynamicFileFormatDependencyData &rhs) { Swap(rhs); }
88
90 inline bool IsEmpty() const {
91 return !_data;
92 }
93
100 PCP_API
102 const PcpDynamicFileFormatInterface *dynamicFileFormat,
103 VtValue &&dependencyContextData,
104 TfToken::Set &&composedFieldNames,
105 TfToken::Set &&composedAttributeNames);
106
109 PCP_API
111 PcpDynamicFileFormatDependencyData &&dependencyData);
112
115 PCP_API
117
120 PCP_API
122
127 PCP_API
129 const TfToken &fieldName,
130 const VtValue& oldValue,
131 const VtValue& newValue) const;
132
137 PCP_API
139 const TfToken &attributeName,
140 const VtValue &oldValue,
141 const VtValue &newValue) const;
142
143private:
144 // Struct containing the entire contents of the dependency.
145 struct _Data
146 {
147 using _ContextData =
148 std::pair<const PcpDynamicFileFormatInterface *, VtValue>;
149 using _ContextDataVector = std::vector<_ContextData>;
150
151 _ContextDataVector dependencyContexts;
152 TfToken::Set relevantFieldNames;
153 TfToken::Set relevantAttributeNames;
154
155 // Helper for adding relevant fields. We avoid copying by taking the
156 // input set if our set is empty.
157 void _AddRelevantFieldNames(TfToken::Set &&fieldNames);
158
159 // Helper for adding relevant attributes. We avoid copying by taking the
160 // input set if our set is empty.
161 void _AddRelevantAttributeNames(TfToken::Set &&attributeNames);
162 };
163
164 // Pointer to data. Will be null if this an empty data object.
165 std::unique_ptr<_Data> _data;
166};
167
168PXR_NAMESPACE_CLOSE_SCOPE
169
170#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:67
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
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:183
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164
Standard pointer typedefs.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:62
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...