HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeInfo.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __PDG_ATTRIBUTE_INFO_H__
10 #define __PDG_ATTRIBUTE_INFO_H__
11 
12 #include "PDG_API.h"
13 
14 #include <UT/UT_ArrayStringMap.h>
15 #include <UT/UT_StringMap.h>
16 #include <UT/UT_StringSet.h>
17 
18 class PDG_NodeInterface;
19 
20 class UT_JSONValueArray;
21 class UT_WorkBuffer;
22 
23 /**
24  * Stores information about the attributes needed and created by a node
25  */
27 {
28 public:
29  /// Whether the attributes is create/used in the generate/cook stage
31  {
32  eOriginNone = 0x0,
33  eOriginGenerate = 0x1,
34  eOriginCook = 0x2,
35  eOriginExpected = 0x4,
36 
37  eOriginGenerateExpected = eOriginGenerate | eOriginExpected,
38  };
39 
40  /// Configuration struct which can be used at either the node template or
41  /// node instance level.
42  struct PDG_API Config
43  {
44  Config() : myDefaultOrigin(eOriginNone) {}
45 
48  };
49 
50  /// Utility struct for information record about attributes used in
51  /// expressions
53  {
56  };
57 
58 public:
59 
60  /// Default attribute origins are initialized to static
62 
63  /// Resets the internal structures of this object. Called during a cook,
64  /// so the info can be re-filled from the inputs, node options and parms
65  void reset();
66 
67 
68  /// Adds the attributes from the maap to the output map of this object
69  void addOutputAttribs(const Config& attrib_config);
70 
71  /// Adds attributes that are consumed by this object
72  void addInputAttribs(const Config& attrib_config);
73 
74  /// Adds the input attributes from the attribute info to the input map of
75  /// this object
76  void addUpstreamAttribs(const PDG_AttributeInfo& info,
77  bool dynamic_generator);
78 
79  /// Copies expression attributes to inputs based on the port map
80  void processExpressionAttribs(
81  const PDG_NodeInterface* node_interface,
82  const UT_ArrayStringMap<int>& ports);
83 
84  /// Returns true if the node needs to be dynamic in order to access the
85  /// attributes it needs to generate.
86  bool checkNeedsDynamic(
87  bool require_inputs) const;
88 
89  /// Returns the output attribute map, i.e. attributes produced by the node
90  /// that owns this object
91  const Config& outputAttributes() const
92  { return myOutputAttributes; }
93 
94  /// Returns the attributes referenced or use during the current cook
95  const Config& inputAttributes() const
96  { return myInputAttributes; }
97 
98  /// Returns the upstream attribute map, i.e. the total set of all upstream
99  /// attributes that might be available to work items in this node.
100  const Config& upstreamAttributes() const
101  { return myUpstreamAttributes; }
102 
103  /// Loads a Config object from a JSON array.
104  static bool fromJSON(
105  Config& config,
106  const UT_JSONValueArray& json_array,
107  UT_WorkBuffer& errors);
108 
109 private:
110  Config myOutputAttributes;
111  Config myInputAttributes;
112  Config myUpstreamAttributes;
113 
114  bool myHasDynamicInputs;
115 };
116 
117 #endif
const Config & upstreamAttributes() const
UT_ArrayStringMap< int > myAttributeCounts
UT_JSONValueArray stores a list of UT_JSONValue objects.
#define PDG_API
Definition: PDG_API.h:23
UT_StringMap< UT_StringSet > myChannelAttributes
class OCIOEXPORT Config
UT_ArrayStringMap< int > myOrigins
AttribOrigin
Whether the attributes is create/used in the generate/cook stage.
GLboolean reset
Definition: glad.h:5138
const Config & inputAttributes() const
Returns the attributes referenced or use during the current cook.
const Config & outputAttributes() const