HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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, 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,
62  void *data, int array_size,
63  bool isconstant);
64 
65  /// Add a string value (with data)
66  /// @note Users should call CVEX_Context::addInput()
67  bool addValue(const UT_StringHolder &name,
69  bool isconstant);
70 
71  /// @{
72  /// Convenience operators
73  const CVEX_Value *operator[](int i) const { return getValue(i); }
74  CVEX_Value *operator[](int i) { return getValue(i); }
75 
76  CVEX_Value *operator()(int i) { return getValue(i); }
78  { return getValue(name, type); }
79  /// @}
80 
81 private:
82  void clear();
83  void addValue(CVEX_Value *value);
84 
85  // Clear the value but leave the null entry in myValues
86  void clearValue(int index);
87 
90  UT_String myError;
91 
92  friend class CVEX_Context;
93 };
94 
95 #endif
CVEX_Value * getValue(int i)
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:147
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:23
A class representing a VEX value.
Definition: CVEX_Value.h:50
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)