HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CVEX_ValueList.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  * NAME: CVEX_ValueList.h ( CVEX Library, C++)
7  *
8  * COMMENTS: C++ interface to VEX. This class is used to specify
9  * a list of input/output values
10  */
11 
12 #ifndef __CVEX_ValueList__
13 #define __CVEX_ValueList__
14 
15 #include "CVEX_API.h"
16 #include "CVEX_Value.h"
17 #include <UT/UT_ValArray.h>
18 #include <UT/UT_SymbolTable.h>
19 
20 /// @brief List of input or output values for a CVEX_Context
21 ///
22 /// This class maintains a list of the input and output parameters for a CVEX
23 /// context.
24 ///
25 /// Both input and output variables are associated with parameters on the VEX
26 /// function being run. Output variables are those flagged with the @c export
27 /// keyword.
29 {
30 public:
32  ~CVEX_ValueList();
33 
34  /// Returns the number of values in the list
35  int entries() const { return myValues.entries(); }
36 
37  /// Get a value by index
38  const CVEX_Value *getValue(int i) const { return myValues(i); }
39  CVEX_Value *getValue(int i) { return myValues(i); }
40 
41  /// Get a value by name and type. Returns NULL if there's no value by
42  /// that name and type.
43  const CVEX_Value *getValue(const UT_StringRef &name, CVEX_Type type) const;
44  CVEX_Value *getValue(const UT_StringRef &name, CVEX_Type type);
45 
46  /// Get a value by name. Returns NULL if there's no value by that name.
47  const CVEX_Value *getValue(const UT_StringRef &name) const
48  { return getValue(name, CVEX_TYPE_INVALID); }
50  { return getValue(name, CVEX_TYPE_INVALID); }
51 
52  /// Add a value by name type and varying flag. This fails if:
53  /// - There's already a symbol with the name
54  /// - The type is invalid
55  /// @note Users should call CVEX_Context::addInput()
56  bool addValue(const UT_StringHolder &name,
57  CVEX_Type type, VEX_Precision, bool varying);
58 
59  /// Add a value by name, type and provide data.
60  /// @note Users should call CVEX_Context::addInput()
61  bool addValue(const UT_StringHolder &name, CVEX_Type type,
63  void *data, int array_size,
64  bool isconstant);
65 
66  /// Add a string value (with data)
67  /// @note Users should call CVEX_Context::addInput()
68  bool addValue(const UT_StringHolder &name,
70  bool isconstant);
71 
72  /// @{
73  /// Convenience operators
74  const CVEX_Value *operator[](int i) const { return getValue(i); }
75  CVEX_Value *operator[](int i) { return getValue(i); }
76 
77  CVEX_Value *operator()(int i) { return getValue(i); }
79  { return getValue(name, type); }
80  /// @}
81 
82 private:
83  void clear();
84  void addValue(CVEX_Value *value);
85 
86  // Clear the value but leave the null entry in myValues
87  void clearValue(int index);
88 
91  UT_String myError;
92 
93  friend class CVEX_Context;
94 };
95 
96 #endif
CVEX_Value * getValue(int i)
VEX_Precision
Definition: VEX_PodTypes.h:25
CVEX_Value * operator[](int i)
List of input or output values for a CVEX_Context.
const CVEX_Value * getValue(int i) const
Get a value by index.
png_uint_32 i
Definition: png.h:2877
Call VEX from C++.
Definition: CVEX_Context.h:151
CVEX_Value * operator()(const UT_StringRef &name, CVEX_Type type)
const CVEX_Value * operator[](int i) const
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1932
CVEX_Type
The CVEX_Type enum defines the VEX types available to CVEX.
Definition: CVEX_Value.h:25
A class representing a VEX value.
Definition: CVEX_Value.h:52
int entries() const
Returns the number of values in the list.
GLsizei const GLfloat * value
Definition: glcorearb.h:823
CVEX_Value * getValue(const UT_StringRef &name)
GLuint index
Definition: glcorearb.h:785
#define CVEX_API
Definition: CVEX_API.h:10
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
const CVEX_Value * getValue(const UT_StringRef &name) const
Get a value by name. Returns NULL if there's no value by that name.
CVEX_Value * operator()(int i)