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  const UT_String& name() const
46  { return myName; }
47  int component() const
48  { return myComponent; }
49  int padding() const
50  { return myPadding; }
51 
52  bool isTimeDependent() const
53  { return myTimeDep; }
54  bool isLocalVar() const
55  { return myIsLocalVar; }
56  bool hasComponent() const
57  { return myHasComponent; }
58  bool needsToBeDeleted() const
59  { return myNeedsToBeDeleted; }
60 
61  // Provide default implementations in case a particular evaluator only
62  // wants to provide one or the other.
63  virtual bool evaluateF(int thread, fpreal &result,
64  EvalDiagnostics &diagnostics) const
65  { return 0.0; }
66  virtual bool evaluateS(int thread, UT_StringHolder &result,
67  EvalDiagnostics &diagnostics) const
69  virtual bool isStringValue() const
70  { return false; }
71  virtual bool isValid() const
72  { return true; }
73 
74  // Copy all our internal data from another attribute evaluator. This is
75  // used by the sop_PDGAttributeEvaluator which wraps one evaluator around
76  // another.
78  {
79  myName = src.myName;
80  myComponent = src.myComponent;
81  myPadding = src.myPadding;
82  myTimeDep = src.myTimeDep;
83  myIsLocalVar = src.myIsLocalVar;
84  myHasComponent = src.myHasComponent;
85  myNeedsToBeDeleted = src.myNeedsToBeDeleted;
86  }
87 
88 protected:
91  int myPadding;
92  bool myTimeDep;
96 };
97 
98 #endif
GLenum src
Definition: glew.h:2410
virtual bool evaluateS(int thread, UT_StringHolder &result, EvalDiagnostics &diagnostics) const
GLuint const GLchar * name
Definition: glew.h:1814
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual bool isValid() const
#define UT_API
Definition: UT_API.h:13
const UT_String & name() const
void copyFrom(const UT_AttributeEvaluator &src)
virtual bool evaluateF(int thread, fpreal &result, EvalDiagnostics &diagnostics) const
static const UT_StringHolder theEmptyString
*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
virtual bool isStringValue() const
double fpreal
Definition: SYS_Types.h:276
GLuint64EXT * result
Definition: glew.h:14007