HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PRM_Utils.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: PRM_Utils.h (Parameter Library)
7  */
8 
9 #ifndef __PRM_Utils_h__
10 #define __PRM_Utils_h__
11 
12 #include "PRM_API.h"
13 #include <EXPR/EX_Error.h>
14 #include <UT/UT_ErrorManager.h>
15 #include <UT/UT_Thread.h>
17 
18 class UT_BitArray;
19 class PRM_ParmList;
20 class PRM_Parm;
21 
22 /// A set of useful functions for working with parameters.
24 {
25 public:
26  typedef void (*TraverseParmFunc)(const PRM_ParmList &, PRM_Parm *,
27  int, void *data);
28 
29  /// Traverse the parameters in the specified folder of the given switcher
30  /// and optionally execute a function on each parameter.
31  ///
32  /// folder_start_index
33  /// - index into the parmlist pointing to first eligible parameter
34  /// for the folder
35  /// traverse_multi_instances
36  /// - call the specified function on the instances of any embedded
37  /// multiparms
38  ///
39  /// Returns the number of parameters to skip in the parmlist to step over
40  /// the folder. Note that this happens whether or not a traverse function
41  /// is provided, and does not account for any embedded multiparm instances.
42  static int traverseFolder(PRM_ParmList &parmlist, PRM_Parm *switcher,
43  int folder, int folder_start_index,
44  bool traverse_multi_instances,
45  TraverseParmFunc function, void *data);
46 
47  // Flag the instances associated with the given multiparm in the provided
48  // bit array.
49  static void flagMultiParmInstances(const PRM_ParmList &parmlist,
50  PRM_Parm *multi, UT_BitArray &flags);
51 };
52 
53 /// Use this to block evaluation errors. This is necessary whenever setting
54 /// or getting parameters outside of the cooking code path
56 {
57 public:
59  : myScope(thread)
60  {
61  myErrNo = ev_GetErrNo(myScope.getThread());
62  myScope.getErrorManager().setDisabled(true);
63  }
65  {
66  ev_SetErrNo(myErrNo, myScope.getThread());
67  ev_ClearCycles(myScope.getThread());
68  }
69 
70 private:
71  UT_ErrorManager::Scope myScope;
72  int myErrNo;
73 };
74 
75 
76 #endif
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2864
PRM_AutoBlockErrors(int thread=SYSgetSTID())
Definition: PRM_Utils.h:58
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
void
Definition: png.h:1083
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
*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
SYS_API int SYSgetSTID()
A set of useful functions for working with parameters.
Definition: PRM_Utils.h:23
#define PRM_API
Definition: PRM_API.h:10
EXPR_API void ev_ClearCycles(int thread)