HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_AttributeEvaluator.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_EVALUATOR_H__
10 #define __PDG_ATTRIBUTE_EVALUATOR_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_AttributeQuery.h"
15 #include "PDG_AttributeTypes.h"
16 
18 #include <UT/UT_StringHolder.h>
19 
20 class PDG_AttributeOwner;
22 class PDG_Node;
23 class PDG_WorkItem;
24 
25 /**
26  * Caches an attribute name and component, for use with @ expression in HScript
27  */
29 {
30 public:
31  /// Controls whether or not string/file attributes should be localized
32  /// when evaluated
33  enum Localize
34  {
35  /// The raw, unlocalized value is always returned
37 
38  /// The default behavior is the evaluating context is used
40 
41  /// The localizd value is always returned
42  eLocalizeAlways
43  };
44 
45 public:
46  PDG_AttributeEvaluator(const char* name);
48  const char* name,
49  int component);
52  int component);
53  ~PDG_AttributeEvaluator() override;
54 
55  /// PDG doesn't know about CH or time, so it must be told about the
56  /// evaluation frame from the caller, e.g. via the TOP subclass of this
57  /// evaluator type.
58  bool evaluateAtFrameF(
59  fpreal frame,
60  int thread,
61  fpreal &result,
62  EvalDiagnostics &diagnostics) const;
63  bool evaluateAtFrameS(
64  fpreal frame,
65  int thread,
67  EvalDiagnostics &diagnostics) const;
68 
69  bool evaluateF(
70  int thread,
71  fpreal &result,
72  EvalDiagnostics &diagnostics) const override
73  {
74  return evaluateAtFrameF(
75  0.0f,
76  thread,
77  result,
78  diagnostics);
79  }
80 
81  bool evaluateS(
82  int thread,
84  EvalDiagnostics &diagnostics) const override
85  {
86  return evaluateAtFrameS(
87  0.0f,
88  thread,
89  result,
90  diagnostics);
91  }
92 
93  bool isStringValue() const override;
94 
95  PDG_AttributeIntrinsic attributeType() const;
96  void setMetadata(
97  const UT_StringHolder& tag,
98  Localize localize,
99  bool all_values);
100 
102  { return myLocalize; }
103  bool isAllValues() const
104  { return myIsAllValues; }
105  const UT_StringHolder& tag() const
106  { return myTag; }
107  const PDG_AttributeQuery&
108  query() const
109  { return myQuery; }
110 
111  void checkTimeDependent();
112 
113 
114  static void recordAttribute(const UT_StringHolder& name,
115  int thread);
116 
117  static bool isSuppressWarnings();
118  static bool setSuppressWarnings(bool suppress);
119 
120  static bool hasAttribute(
121  int thread,
122  const char* name,
123  bool check_intrinsic);
124 
125 private:
126  void reportWarning(
127  PDG_AttributeCast cast_result,
128  exint query_index,
129  const PDG_AttributeOwner* owner,
130  const PDG_Node* node,
131  bool is_string,
132  int thread) const;
133  void recordAttribute(
135  int thread) const;
136 
137  bool isInputFile() const;
138  bool isOutputFile() const;
139 
140 private:
141  PDG_AttributeQuery myQuery;
142  UT_StringHolder myTag;
143  PDG_AttributeIntrinsic myAttributeType;
144  Localize myLocalize;
145  bool myIsAllValues;
146 };
147 
148 #endif
PDG_AttributeIntrinsic
Enumeration of types of attribute that can be queried from work items.
#define PDG_API
Definition: PDG_API.h:23
int64 exint
Definition: SYS_Types.h:125
const UT_StringHolder & tag() const
**But if you need a result
Definition: thread.h:622
bool evaluateS(int thread, UT_StringHolder &result, EvalDiagnostics &diagnostics) const override
The raw, unlocalized value is always returned.
GLfloat f
Definition: glcorearb.h:1926
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
bool evaluateF(int thread, fpreal &result, EvalDiagnostics &diagnostics) const override
PDG_AttributeCast
Enumeration of attribute cast results.
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual bool isStringValue() const
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
The default behavior is the evaluating context is used.
fpreal64 fpreal
Definition: SYS_Types.h:283
const PDG_AttributeQuery & query() const