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 0.0; }
77  virtual bool evaluateS(int thread, UT_StringHolder &result,
78  EvalDiagnostics &diagnostics) const
80  virtual bool isStringValue() const
81  { return false; }
82  virtual bool isValid() const
83  { return true; }
84 
85  // Copy all our internal data from another attribute evaluator. This is
86  // used by the sop_PDGAttributeEvaluator which wraps one evaluator around
87  // another.
89  {
90  myName = src.myName;
91  myComponent = src.myComponent;
92  myPadding = src.myPadding;
93  myTimeDep = src.myTimeDep;
94  myIsLocalVar = src.myIsLocalVar;
95  myHasComponent = src.myHasComponent;
96  myNeedsToBeDeleted = src.myNeedsToBeDeleted;
97  }
98 
99  // Returns the evaluator type for the specified prefix. Returns
100  // EVAL_COUNT if the prefix is invalid.
101  static EvalType typeFromPrefix(const char* prefix);
102 
103 protected:
107  bool myTimeDep;
111 };
112 
113 #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:623
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:613
void copyFrom(const UT_AttributeEvaluator &src)
virtual bool evaluateF(int thread, fpreal &result, EvalDiagnostics &diagnostics) const
static const UT_StringHolder theEmptyString
#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:277
GLenum src
Definition: glcorearb.h:1793