HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_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  * This is a base class for custom attribute evaluators used with the
8  * @ function in HScript. Currently used by SOPs, LOPs and PDG.
9  *
10  * The constructor will parse the attribute name to determine if there
11  * is a component number or letter. For example, @foo.x, @color.r,
12  * @coord.u or @pdg_input.5.
13  *
14  * Optionally, it can also be configured to check for a color :pad
15  * value. This is currently only used by PDG attributes. For example,
16  * @pdg_index:4 to pad the index value to 4 digits. The color must
17  * be processed prior to the component extension to allow for the
18  * syntax @attrib.y:2.
19  */
20 
21 #ifndef __UT_AttributeEvaluator_h__
22 #define __UT_AttributeEvaluator_h__
23 
24 #include "UT_String.h"
25 #include "UT_StringHolder.h"
26 #include "UT_Error.h"
27 #include "UT_NonCopyable.h"
28 
30 {
31 public:
32  UT_AttributeEvaluator(const char *name, bool check_pad=false);
33  virtual ~UT_AttributeEvaluator();
34 
36 
38  {
39  public:
41  : myErrorSeverity(UT_ERROR_NONE)
42  { }
43 
46  };
47 
48  enum EvalType
49  {
53  EVAL_COUNT
54  };
55 
56  const UT_String& name() const
57  { return myName; }
58  int component() const
59  { return myComponent; }
60  int padding() const
61  { return myPadding; }
62 
63  bool isTimeDependent() const
64  { return myTimeDep; }
65  bool isLocalVar() const
66  { return myIsLocalVar; }
67  bool hasComponent() const
68  { return myHasComponent; }
69  bool needsToBeDeleted() const
70  { return myNeedsToBeDeleted; }
71 
72  // Provide default implementations in case a particular evaluator only
73  // wants to provide one or the other.
74  virtual bool evaluateF(int thread, fpreal &result,
75  EvalDiagnostics &diagnostics) const
76  { return false; }
77  virtual bool evaluateS(int thread, UT_StringHolder &result,
78  EvalDiagnostics &diagnostics) const
79  { return false; }
80  virtual bool isStringValue() const
81  { return false; }
82  virtual bool isValid() const
83  { return true; }
84 
85  // Returns the evaluator type for the specified prefix. Returns
86  // EVAL_COUNT if the prefix is invalid.
87  static EvalType typeFromPrefix(const char* prefix);
88 
89  // Returns a descriptive name for the specified prefix, for erroring
90  // reporting. Returns empty string if the prefix is invalid.
91  static const char* nameFromPrefix(const char* prefix);
92 
93 protected:
96  int myPadding;
97  bool myTimeDep;
101 };
102 
103 #endif
virtual bool evaluateS(int thread, UT_StringHolder &result, EvalDiagnostics &diagnostics) const
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual bool isValid() const
#define UT_API
Definition: UT_API.h:14
const UT_String & name() const
**But if you need a result
Definition: thread.h:622
virtual bool evaluateF(int thread, fpreal &result, EvalDiagnostics &diagnostics) const
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
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
fpreal64 fpreal
Definition: SYS_Types.h:283