HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_OutputInfo.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: VOP Library (C++)
7 *
8 * COMMENTS:
9 *
10 */
11 
12 #ifndef __VOP_OutputInfo_h__
13 #define __VOP_OutputInfo_h__
14 
15 #include <UT/UT_Options.h>
16 #include "VOP_API.h"
17 #include <map>
18 #include <string>
19 #include <iosfwd>
20 
21 
22 #define VOP_AUTO_CORR_INPUT_TOKEN "___auto___"
23 #define VOP_DEFAULT_INPUT_TOKEN "__default__"
24 
25 class VOP_Node;
26 /******************************************************************************/
27 // Ascii tokens
28 static const char VOP_NUM_INFOS_TOKEN[] = "NumInfos";
29 static const char VOP_BEGIN_INFO_RECORD_TOKEN[] = "BeginInfo";
30 static const char VOP_NORMAL_MODE_TOKEN[] = "NormalMode";
31 static const char VOP_END_INFO_RECORD_TOKEN[] = "EndInfo";
32 static const char VOP_OUTPUT_NAME_TOKEN[] = "OutputName";
33 static const char VOP_BYPASS_MODE_TOKEN[] = "BypassMode";
34 static const char VOP_ARE_VALUES_BINARY_TOKEN[] = "ValuesBinary";
35 static const char VOP_DEBUG_CORR_INPUT_NAME_TOKEN[] = "DebugCorrInputName";
36 static const char VOP_BYPASS_CORR_INPUT_NAME_TOKEN[] = "BypassCorrInputName";
37 static const char VOP_USE_DEFAULT_VALUE_TOKEN[] = "UseDefaultValue";
38 
39 static const char VOP_COMMENT_CHAR = '#';
40 
41 // Binary tokens
42 enum
43 {
44  VOP_NUM_INFOS = 100, // give some room for future growth
46 
54 
56 };
57 /******************************************************************************/
58 // Note: the order of these must correspond to the FUSE_VopTile.ui menu items.
60 {
64 
66 };
67 /******************************************************************************/
69 {
70 public:
71 
72  VOP_OutputInfo(VOP_Node* parent_node, const char* output_name);
73  ~VOP_OutputInfo();
74 
75  /// Sets the behaviour type for this output in the debug mode.
76  void setDebugMode(EOutputModeType mode);
77  /// Sets the behaviour type for this output in the bypass mode.
78  void setBypassedMode(EOutputModeType mode);
79 
80  EOutputModeType getDebugMode();
81  EOutputModeType getBypassMode();
82 
83  /// Retrieves the constant value pointer for the debug mode.
84  UT_Options* getDebugValuePtr();
85  /// Retrieves the constant value pointer for the release mode.
86  UT_Options* getBypassValuePtr();
87 
88  void appendOutputOverrideCode(UT_String& str_code, bool is_in_debug_mode, bool is_in_bypass_mode);
89 
90  /// Returns the index of the output this info applies to.
91  int getIndex();
92 
93  /// Returns the variable name that should be used in the override code.
94  /// The variable may or may not be prefixed with '$', depending if
95  /// the output variable name is fixed or not. In majority of cases it is,
96  /// but for vops such as globals or exporting parm vop, it is not.
97  void getOutputVariableCode(UT_String &var_code);
98 
99  bool save(std::ostream &os, bool is_binary);
100  bool load(UT_IStream &is);
101 
102  /// Returns the name of the output this info applies to.
103  const char* getOutputName();
104  const char* getDebugCorrespondingInputName();
105  const char* getBypassCorrespondingInputName();
106  void setDebugCorrespondingInputName(const char* input_name);
107  void setBypassCorrespondingInputName(const char* input_name);
108 
109  void setUseDefaultValue(bool val) { myUseDefaultVal = val; }
110  bool getUseDefaultValue() { return myUseDefaultVal; }
111 
112  /// Attempts to find an input which (logically) corresponds to this
113  /// output, and returns its index if found or -1 otherwise. Note that
114  /// this looks at any explicit corresponding input names that may
115  /// be specified, and returns that, if found, first.
116  int findCorrespondingInput(bool is_in_debug_mode, bool is_in_bypass_mode);
117 
118  /// Attempts to find an input which best corresponds to the output with the
119  /// name specified on the given node.
120  static int autoFindCorrespondingInput(VOP_Node* node, const char* output_name);
121 
122 private:
123 
124  VOP_Node* myParentNode;
125  std::string myOutputName;
126 
127  // The mode which dictates what to output in normal state.
128  EOutputModeType myDebugMode;
129 
130  // The mode which dictates what to output in bypassed state.
131  EOutputModeType myBypassedMode;
132 
133  UT_Options myDebugValue, myBypassValue;
134 
135  std::string myDebugCorrespondingInputName, myBypassCorrespondingInputName;
136  bool myUseDefaultVal;
137 };
138 /******************************************************************************/
139 typedef std::map < std::string, VOP_OutputInfo* > TOutputInfosMap;
140 /******************************************************************************/
141 #endif
std::map< std::string, VOP_OutputInfo * > TOutputInfosMap
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
void setUseDefaultValue(bool val)
#define VOP_API
Definition: VOP_API.h:10
EOutputModeType
GLenum mode
Definition: glcorearb.h:99
A map of string to various well defined value types.
Definition: UT_Options.h:84
GLuint GLfloat * val
Definition: glcorearb.h:1608
bool getUseDefaultValue()