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 "PRM_Type.h"
14 #include <EXPR/EX_Error.h>
15 #include <UT/UT_ErrorManager.h>
16 #include <UT/UT_Thread.h>
18 
19 class UT_BitArray;
20 class PRM_ParmList;
21 class PRM_Parm;
22 
23 /// A set of useful functions for working with parameters.
25 {
26 public:
27  typedef void (*TraverseParmFunc)(const PRM_ParmList &, PRM_Parm *,
28  int, void *data);
29 
30  /// Traverse the parameters in the specified folder of the given switcher
31  /// and optionally execute a function on each parameter.
32  ///
33  /// folder_start_index
34  /// - index into the parmlist pointing to first eligible parameter
35  /// for the folder
36  /// traverse_multi_instances
37  /// - call the specified function on the instances of any embedded
38  /// multiparms
39  ///
40  /// Returns the number of parameters to skip in the parmlist to step over
41  /// the folder. Note that this happens whether or not a traverse function
42  /// is provided, and does not account for any embedded multiparm instances.
43  static int traverseFolder(PRM_ParmList &parmlist, PRM_Parm *switcher,
44  int folder, int folder_start_index,
45  bool traverse_multi_instances,
46  TraverseParmFunc function, void *data);
47 
48  // Flag the instances associated with the given multiparm in the provided
49  // bit array.
50  static void flagMultiParmInstances(const PRM_ParmList &parmlist,
51  PRM_Parm *multi, UT_BitArray &flags);
52 
53  // Return the parm basic type from a parm type commonly used
54  // by python handles/states.
55  static PRM_Type::PRM_BasicType parmTypeToBasic(PRM_Parm const& parm);
56 };
57 
58 /// Use this to block evaluation errors. This is necessary whenever setting
59 /// or getting parameters outside of the cooking code path
61 {
62 public:
64  : myScope(thread)
65  {
66  myErrNo = ev_GetErrNo(myScope.getThread());
67  myScope.getErrorManager().setDisabled(true);
68  }
70  {
71  ev_SetErrNo(myErrNo, myScope.getThread());
72  ev_ClearCycles(myScope.getThread());
73  }
74 
75 private:
76  UT_ErrorManager::Scope myScope;
77  int myErrNo;
78 };
79 
80 #endif
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
GLbitfield flags
Definition: glcorearb.h:1596
void
Definition: png.h:1083
GLboolean * data
Definition: glcorearb.h:131
PRM_AutoBlockErrors(int thread=SYSgetSTID())
Definition: PRM_Utils.h:63
**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:24
PRM_BasicType
Definition: PRM_Type.h:30
#define PRM_API
Definition: PRM_API.h:10
EXPR_API void ev_ClearCycles(int thread)
Definition: format.h:1821