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  // Note that these are not the proper overrides for the virtual
56  // evaluateF and evaluateS methods. Because PDG is built before CH,
57  // we have to be passed the current frame number by a wrapper
58  // UT_AttributeEvaluator subclass defined in OP.
59  bool evaluateAtFrameF(fpreal frame, int thread,
60  fpreal &result,
61  EvalDiagnostics &diagnostics) const;
62  bool evaluateAtFrameS(fpreal frame, int thread,
64  EvalDiagnostics &diagnostics) const;
65  bool isStringValue() const override;
66 
67  PDG_AttributeIntrinsic attributeType() const;
68  void setMetadata(
69  const UT_StringHolder& tag,
70  Localize localize,
71  bool all_values);
72 
74  { return myLocalize; }
75  bool isAllValues() const
76  { return myIsAllValues; }
77  const UT_StringHolder& tag() const
78  { return myTag; }
79  const PDG_AttributeQuery&
80  query() const
81  { return myQuery; }
82 
83  void setWrapperEvaluator(UT_AttributeEvaluator *wrapper);
84  UT_AttributeEvaluator *wrapperEvaluator() const;
85  void checkTimeDependent();
86 
87 
88  static void recordAttribute(const UT_StringHolder& name,
89  int thread);
90 
91  static bool isSuppressWarnings();
92  static bool setSuppressWarnings(bool suppress);
93 
94 private:
95  void reportWarning(
96  PDG_AttributeCast cast_result,
97  exint query_index,
98  const PDG_AttributeOwner* owner,
99  const PDG_Node* node,
100  bool is_string,
101  int thread) const;
102  void recordAttribute(
104  int thread) const;
105 
106  bool isInputFile() const;
107  bool isOutputFile() const;
108 
109 private:
110  UT_AttributeEvaluator *myWrapperEvaluator;
111  PDG_AttributeQuery myQuery;
112  UT_StringHolder myTag;
113  PDG_AttributeIntrinsic myAttributeType;
114  Localize myLocalize;
115  bool myIsAllValues;
116 };
117 
118 #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
The raw, unlocalized value is always returned.
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
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:278
const PDG_AttributeQuery & query() const