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 
29 {
30 public:
31  UT_AttributeEvaluator(const char *name, bool check_pad=false);
32  virtual ~UT_AttributeEvaluator();
33 
35  {
36  public:
38  : myErrorSeverity(UT_ERROR_NONE)
39  { }
40 
43  };
44 
45  enum EvalType
46  {
50  EVAL_COUNT
51  };
52 
53  const UT_String& name() const
54  { return myName; }
55  int component() const
56  { return myComponent; }
57  int padding() const
58  { return myPadding; }
59 
60  bool isTimeDependent() const
61  { return myTimeDep; }
62  bool isLocalVar() const
63  { return myIsLocalVar; }
64  bool hasComponent() const
65  { return myHasComponent; }
66  bool needsToBeDeleted() const
67  { return myNeedsToBeDeleted; }
68 
69  // Provide default implementations in case a particular evaluator only
70  // wants to provide one or the other.
71  virtual bool evaluateF(int thread, fpreal &result,
72  EvalDiagnostics &diagnostics) const
73  { return 0.0; }
74  virtual bool evaluateS(int thread, UT_StringHolder &result,
75  EvalDiagnostics &diagnostics) const
77  virtual bool isStringValue() const
78  { return false; }
79  virtual bool isValid() const
80  { return true; }
81 
82  // Copy all our internal data from another attribute evaluator. This is
83  // used by the sop_PDGAttributeEvaluator which wraps one evaluator around
84  // another.
86  {
87  myName = src.myName;
88  myComponent = src.myComponent;
89  myPadding = src.myPadding;
90  myTimeDep = src.myTimeDep;
91  myIsLocalVar = src.myIsLocalVar;
92  myHasComponent = src.myHasComponent;
93  myNeedsToBeDeleted = src.myNeedsToBeDeleted;
94  }
95 
96  // Returns the evaluator type for the specified prefix. Returns
97  // EVAL_COUNT if the prefix is invalid.
98  static EvalType typeFromPrefix(const char* prefix);
99 
100 protected:
104  bool myTimeDep;
108 };
109 
110 #endif
virtual bool evaluateS(int thread, UT_StringHolder &result, EvalDiagnostics &diagnostics) const
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual bool isValid() const
#define UT_API
Definition: UT_API.h:14
const UT_String & name() const
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum src
Definition: glcorearb.h:1792
void copyFrom(const UT_AttributeEvaluator &src)
GLuint64EXT * result
Definition: glew.h:14311
virtual bool evaluateF(int thread, fpreal &result, EvalDiagnostics &diagnostics) const
static const UT_StringHolder theEmptyString
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:277