dynamicFileFormatContext.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_CONTEXT_H
8 #define PXR_USD_PCP_DYNAMIC_FILE_FORMAT_CONTEXT_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/pcp/api.h"
12 #include "pxr/usd/pcp/node.h"
13 
14 PXR_NAMESPACE_OPEN_SCOPE
15 
16 class PcpPrimIndex_StackFrame;
17 class PcpCache;
18 
27 {
28 public:
29  using VtValueVector = std::vector<VtValue>;
30 
31  PCP_API
32  ~PcpDynamicFileFormatContext() = default;
33 
38  PCP_API
39  bool ComposeValue(const TfToken &field, VtValue *value) const;
40 
50  PCP_API
51  bool ComposeValueStack(const TfToken &field,
52  VtValueVector *values) const;
53 
57  PCP_API
59  const TfToken &attributeName, VtValue *value) const;
60 
61 private:
69  const PcpNodeRef &parentNode,
70  const SdfPath &pathInNode,
71  int arcNum,
72  PcpPrimIndex_StackFrame *previousFrame,
73  TfToken::Set *composedFieldNames,
74  TfToken::Set *composedAttributeNames);
75 
77  friend PcpDynamicFileFormatContext Pcp_CreateDynamicFileFormatContext(
78  const PcpNodeRef &, const SdfPath&, int, PcpPrimIndex_StackFrame *,
80 
84  bool _IsAllowedFieldForArguments(
85  const TfToken &field, bool *fieldValueIsDictionary = nullptr) const;
86 
87 private:
88  PcpNodeRef _parentNode;
89  SdfPath _pathInNode;
90  int _arcNum;
91  PcpPrimIndex_StackFrame *_previousStackFrame;
92 
93  // Cached names of fields that had values composed by this context.
94  TfToken::Set *_composedFieldNames;
95 
96  // Cached names of attributes that had default values composed by this
97  // context.
98  TfToken::Set *_composedAttributeNames;
99 
100  // Declare private helper.
101  class _ComposeValueHelper;
102 };
103 
104 PXR_NAMESPACE_CLOSE_SCOPE
105 
106 #endif // PXR_USD_PCP_DYNAMIC_FILE_FORMAT_CONTEXT_H
PCP_API bool ComposeAttributeDefaultValue(const TfToken &attributeName, VtValue *value) const
Compose the value of the default field of the attribute with the given attributeName and return its c...
Context object for the current state of a prim index that is being built that allows implementations ...
PCP_API bool ComposeValueStack(const TfToken &field, VtValueVector *values) const
Compose the values of the given field returning all available opinions ordered from strongest to weak...
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:46
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:76
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:80
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:193
PCP_API bool ComposeValue(const TfToken &field, VtValue *value) const
Compose the value of the given field and return its current strongest opinion.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:89