HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_ResourceManager.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: PI_ResourceManager.h ( Direct Manipulation Library, C++)
7  *
8  * COMMENTS:
9  * This class maintains a table of all states, handles, op-handle links,
10  * and input selectors. All state, handle, and op-handle link objects
11  * are created and deleted through a PI_ResourceManager. The active one
12  * is obtained via the global function BMgetResourceManager().
13  */
14 
15 #ifndef __PI_ResourceManager_H__
16 #define __PI_ResourceManager_H__
17 
18 #include "PI_API.h"
19 #include "PI_ResourceTemplate.h"
20 #include "PI_SettingList.h"
21 #include "PI_PythonResourceTypes.h"
22 
23 #include <OP/OP_Error.h>
24 #include <OP/OP_OperatorTable.h>
25 #include <UT/UT_Array.h>
26 #include <UT/UT_String.h>
27 #include <UT/UT_StringMap.h>
28 #include <UT/UT_SymbolTable.h>
29 #include <UT/UT_ValArray.h>
30 #include <SYS/SYS_Hash.h>
31 #include <SYS/SYS_TypeDecorate.h>
32 #include <utility>
33 
34 class CPP_Manager;
35 class PRM_Template;
36 class OP_Operator;
37 class OP_OperatorTable;
38 class OP_Node;
39 class CMD_Args;
40 class PI_OpHandleLink;
41 class pi_OpHandleBinding;
42 class pi_OpSelectorBinding;
43 
44 namespace PI_PythonState
45 {
46  class Template;
47 }
48 
49 namespace PI_PythonHandle
50 {
51  class Template;
52 }
53 
54 /// Error codes retured by PI_ResourceManager bind methods
55 /// @{
56 #define PI_BIND_OK 1
57 #define PI_NO_TEMPLATE_FOR_HANDLE -2
58 #define PI_INVALID_OP_PARM -3
59 #define PI_INVALID_PI_PARM -4
60 #define PI_BINDING_EXISTS -5
61 #define PI_INVALID_OP_FOR_PI -6
62 /// @}
63 
64 typedef void (*PI_SaveCallback)(void *data);
65 
67 {
68 public:
70 
71  // Note this is the channel name: the receiver should do a
72  // PRM_ParmList::getParmPtrFromChannel to get the parm.
73  const UT_String &getOpParm() const
74  { return myOpParm; }
75  const UT_String &getPIParm() const
76  { return myPIParm; }
77  int operator==(const PI_BindingParmInfo &i) const
78  { return (this == &i); }
79 
80 private:
81  UT_String myOpParm;
82  UT_String myPIParm;
83  friend class pi_OpHandleBinding;
84 };
85 
90 
92 {
93 public:
95 
96  const UT_String &getPIName() const
97  { return myPIName; }
98  const UT_String &getPIDescription() const
99  { return myPIDescription; }
101  { return myDefaultSettings; }
102  int getId() const
103  { return myId; }
105  { return myBindings; }
106  int operator==(const PI_BindingHandleInfo &i) const
107  { return (this == &i); }
108 
109 private:
110  UT_String myPIName;
111  UT_String myPIDescription;
112  PI_SettingList myDefaultSettings;
113  int myId;
114  PI_BindingParmArray myBindings;
115  friend class pi_OpHandleBinding;
116 };
117 
119 
121 
122 // See the bindSelector function for a description of all the data
123 // members of this class. They map directly to the bindSelector parameters.
125 {
126 public:
128 
129  const UT_String &getName() const
130  { return myName; }
131  const UT_String &getDescription() const
132  { return myDescription; }
133  const UT_String &getPrompt() const
134  { return myPrompt; }
135  const UT_String &getOpParm() const
136  { return myOpParm; }
137  const UT_String &getMenu() const
138  { return myMenu; }
139  const UT_String &getPrimMask() const
140  { return myPrimMask; }
141  int getOpInput() const
142  { return myOpInput; }
143  bool getOpInputReq() const
144  { return myOpInputReq; }
145  bool getAllowDrag() const
146  { return myAllowDrag; }
147  bool getAstSelAll() const
148  { return myAstSelAll; }
149  const UT_String &getExtraInfo() const
150  { return myExtraInfo; }
151  int operator==(const PI_BindingSelectorInfo &i) const
152  { return (this == &i); }
153 
154 private:
155  UT_String myName;
156  UT_String myDescription;
157  UT_String myPrompt;
158  UT_String myOpParm;
159  UT_String myMenu;
160  UT_String myPrimMask;
161  int myOpInput;
162  bool myOpInputReq;
163  bool myAllowDrag;
164  bool myAstSelAll;
165  UT_String myExtraInfo;
166  friend class pi_OpSelectorBinding;
167 };
169 
172 {
173 public:
175  ~PI_ResourceManager() override;
176 
177  // Return 1 on success and 0 if the state/handle/op-handle link
178  // is already registered.
179  virtual int registerState(PI_StateTemplate *type);
180  virtual int registerHandle(PI_HandleTemplate *type);
181  virtual int registerOpHandleLink(PI_PITemplate *type);
182  virtual int registerSelector(PI_SelectorTemplate *type);
183 
184  bool containsState(const char *name,
185  PI_ViewerType viewer_type,
186  unsigned netmask) const;
187  bool containsHandle(const char *name) const;
188  bool containsOpHandleLink(const char *name) const;
189  bool containsSelector(const char *name) const;
190 
191  // Get all the bound handles and parms for a given op type.
193  *getBindingHandles(OP_Operator *op) const;
194  // Get all the bound selectors for a given op type.
196  *getBindingSelectors(OP_Operator *op) const;
197 
198  // Return the list of states that can be used in a viewer for the
199  // specified network type.
201  &stateList(PI_ViewerType viewer_type,
202  const char *network_type) const;
204  &stateList(PI_ViewerType viewer_type,
205  PI_NetworkType net_type) const;
206  PI_StateTemplate *getStateTemplate(const char *name,
207  PI_ViewerType viewer_type,
208  const char *type) const;
209  PI_StateTemplate *getStateTemplate(OP_Operator *op,
210  PI_ViewerType viewer_type,
211  const char *type) const;
212 
213  // Rebuild the volatile keys for all state templates.
214  void rebuildVolatileKeys();
215 
216  // Viewer state handling
217  // Return the registration status of a state template.
219  getViewerStateRegisterStatus(
220  const char* state_name, PI_ViewerType viewer_type, const char* type) const;
221 
222  // Fires a register viewer state event callback
223  virtual void fireResourceEvent(
226  PI_PythonResource::EventMessage::Data const& event_data);
227 
228  // return true if the state name is valid
229  bool validStateTemplateName(const char* name) const;
230 
231  // unregister a python viewer state
232  virtual PI_PythonResource::Status unregisterViewerState(const char* name);
233 
234  // return true if a viewer state is registered
235  virtual bool isRegisteredViewerState(const char* name) const;
236 
237  // return a viewer state given a name
238  virtual PI_PythonState::Template const * viewerStateTemplate(const char * state_name) const;
239  virtual PI_PythonState::Template * viewerStateTemplate(const char * state_name) ;
240 
241  // Unbind all volatile viewer handles contained in a viewer state
242  virtual PI_PythonResource::Status unbindVolatileViewerHandles(const char * state_name);
243 
244  // Viewer Handles
245  virtual PI_PythonResource::Status unregisterViewerHandle(const char* name);
246  virtual bool isRegisteredViewerHandle(const char* name) const;
247 
248  virtual PI_PythonHandle::Template const*
249  viewerHandleTemplate(const char* handle_name) const;
250 
251  // Returns the registered viewer handle types (PI template name)
252  virtual UT_StringArray const & getViewerHandleTypeNames() const;
253 
254  // These are functions which are called from commands that allow
255  // for dynamic binding of handles to parameters
256  int unbind(OP_Operator *op, const char *pidescription,
257  const UT_String &opparm);
258  int bind(OP_Operator *op, const char *piname,
259  const char *pidescription,
260  const UT_String &opparm,
261  const UT_String &piparm,
262  const char *default_settings);
263  // this API is typically used for handle late-binding e.g. python states
264  // would provide functions for binding handle parms
265  int bind(OP_Operator *op, const char *piname,
266  const char *pidescription,
267  const char *default_settings);
268  int bindScriptOp(OP_Operator *op, const char *piname,
269  const char *pidescription,
270  const UT_String &opparm,
271  const UT_String &piparm,
272  const char *default_settings);
273 
274  // Used for binding node operators to registered viewer states (i..e. python states)
275  // returns true if the operation succeeded
276  virtual bool bindOperatorToViewerState(const char* state_name, OP_Operator* op);
277 
278  // Returns true if a state is expected to exist for an operator of a given
279  // network type. By design, management operators are not expected to operate
280  // outside their own network, this function will return false in this case.
281  //
282  // op_name: operator name
283  // op_type: operator type e.g. DOP
284  bool operatorStateMandatory(const char* op_name, const char* op_type) const;
285 
286  /// Unbind the given selector from an operator. Uses the short description
287  /// when bound using bindSelector()
288  int unbindSelector(OP_Operator *op,
289  const char *seldescription);
290 
291  /// Dynamic binding of a selector to an operator
292  ///
293  /// @param op Operator type that we want to bind a selector to
294  /// @param sname Selector type
295  /// @param seldescription Short description that identifies this selector
296  /// in the context of a one operator (used to
297  /// unbind the selector).
298  /// @param prompt Text in the status area when the selector is
299  /// active.
300  /// @param opparm Operator parameter where the selection string
301  /// is put.
302  /// @param opinput Wire input index where the op owning the
303  /// selected geometry is attached to our op.
304  /// @param opinputreq Is an input is required?
305  /// @param primmask Mask of which primitive types can be in the
306  /// selection. This uses the *_FILEID enum in
307  /// GEO_PrimTypeCompat.h. A regular
308  /// GEO_PrimTypeCompat mask can be used if you
309  /// first convert it using
310  /// GEO_PrimTypeCompat::convertToFileFromMask()
311  /// @param allowdrag Determines if click-and-drag operations are
312  /// allowed.
313  /// @param menu Operator menu parameter where we choose the
314  /// selection type.
315  /// @param astselall If an asterisk is required in the selection
316  /// string to indicate selecting all the input.
317  /// Otherwise we assume an empty string indicates
318  /// that the whole geometry is selected.
319  /// @param extrainfo String that is passed to the selector,
320  /// particular selectors may need specific
321  /// parameters that can be passed through this
322  /// mechanism.
323  /// @param fromScriptOp Used by our dialog script parser to avoid
324  /// infinite recursion. Setting this flag decreases
325  /// the error checking we do.
326  ///
327  /// @return PI_BIND_OK upon success, else see of one of the other potential
328  /// error codes at the top of PI_ResourceManager.h
329  int bindSelector(OP_Operator *op, const char *sname,
330  const char *seldescription,
331  const char *prompt, const char *opparm,
332  int opinput, int opinputreq,
333  const char *primmask, int allowdrag,
334  const char *menu, int astselall,
335  const char *extrainfo, bool fromScriptOp);
336 
337  //Helper functions for the above
338  PRM_Template *getTemplateAndVecId(const UT_String &,
339  OP_Operator *,
340  int &) const;
341 
342  // This is for converting old style "t 2" into new style "tz". It
343  // only works if the operator has the template already, else it
344  // assumes channel name == parmname. Thus, it won't work on
345  // multiparms that only exist with OP_Node, not OP_Operator.
346  void getChannelNameFromParmAndVec(UT_String &chan,
347  OP_Operator *op, const char *parmname,
348  int vecidx);
349 
350  int checkForPIName( const char *pi_name,
351  const char *pi_parm ) const;
352 
353  OP_Operator *findOperator(PI_NetworkType net_type,
354  const char *op_name,
355  bool display_warning = true) const;
356  OP_Operator *findOperator(const char *opbindname,
357  UT_String *optype = 0) const;
358 
359  virtual void findVolatileKeys(const char *volatile_hotkey_name,
360  UT_Array<int> &volatile_keys,
361  UT_Array<int> &keys_modifiers)
362  const;
363  virtual void updateViewports(int id, const char *opname,
364  bool open_only = false) const;
365 
366  //These methods are used in PI_ResourceManagerCommand.C.
367  const PI_OpHandleLinkMap &getOpHandleLinks() const { return myOpHandleLinks; }
368  PI_PITemplate *getOpHandleLinkTemplate(const char *pi_name) const;
369  const PI_SelectorTemplateMap &getSelectors() const { return mySelectors; }
370  PI_SelectorTemplate *getSelectorTemplate(const char *selector_name) const;
371 
372  // Returns a list of all builtin op handles
373  const UT_StringArray &getBuiltinOpHandleNames();
374 
375  // The following method is used by builddialogs
376  const PI_HandleTemplateMap &getHandles() const { return myHandles; }
377 
378  // Tell us if the pi with the given name is an invisible PI by nature.
379  // Optionally return the type of the pi in isfloat (int or float assumed)
380  bool isPIEthereal(const char *piname,
381  bool *isfloat = 0) const;
382 
383  // Because the order of callbacks for OP_UpdateTableSink is
384  // undefined, some callbacks rely on the resource manager's table of states
385  // to be accurate. Since the resource manager's callback can happen
386  // after the other callbacks, they can call these methods to ensure the
387  // resource manager's table is accurate.
388  void ensureStatesExistForAllOperators(const char *net_type_name);
389  virtual void ensureStatesExistForAllOperators(PI_NetworkType net_type);
390 
391  // Map a viewer type token to a PI_ViewerType, or vice-versa.
392  static bool getViewerType(const char *viewer_type_token,
393  PI_ViewerType &type);
394  static void getViewerTypeToken(PI_ViewerType type,
395  UT_String &viewer_type_token);
396 
397  // Map the network name returned by OP_Node::getOpType() to a
398  // PI_NetworkType, or vice-versa.
399  static bool getNetworkType(const char *network_type_name,
400  PI_NetworkType &type);
401  static const UT_StringHolder &getNetworkTypeName(PI_NetworkType type);
402  static OP_OperatorTable *getOpTableFromOperator(const OP_Operator *op);
403 
404  // Choose the first network type from a mask that contains multiple ones.
405  static PI_NetworkType getFirstNetworkType(unsigned int network_mask);
406 
407  static PRM_Template *findParmTemplate(OP_Operator &op,
408  const char *op_Parm_name,
409  int vec_idx, int *parm_idx);
410 
411  // Write out our bindings information to a file.
412  int writeBindingsFile(const char *fname) const;
413 
414  // Load/save/remove the settings for a particular PI and a node that's
415  // linked to it.
416  void loadPISettingsFromTables(PI_OpHandleLink &pi,
417  bool okay_to_use_last_settings) const;
418  void savePISettingsToTables(PI_OpHandleLink &pi);
419  virtual void removePISettingsFromTables(OP_Operator &op_type);
420  void removePISettingsFromTables(const PI_OpHandleLink &pi);
421 
422  // Record settings for a particular PI. This method should only be
423  // called by the omparm command.
424  void recordPISettings(const char *pi_description,
425  const char *pi_type,
426  const OP_Node &op_node,
427  const char *settings);
428 
429  // Objects may add callbacks that are called just before the resource
430  // manager saves its data to the hip file. These callbacks update
431  // the resource manager to make sure the data it saves is current.
432  void addSaveCallback(PI_SaveCallback callback, void *data);
433  void removeSaveCallback(PI_SaveCallback callback,
434  void *data);
435 
436  void registerOpHandleBindings();
437  virtual void removeAllBindings(OP_Operator *op);
438 
439  // Returns the name of the state being created
440  char const* stateToCreate() const;
441 
442  // Set by BM_PythonSupport to give access to the python support
443  // object while the python resource instance is being created.
444  void setPythonResourceSupport(void* res_support);
445  void* getPythonResourceSupport();
446 
447 protected:
448  static void startParmsCache();
449  static void stopParmsCache();
450  static void getParmsCache(UT_ValArray<OP_Node *> *&ops,
451  UT_ValArray<PRM_Parm *> *&parms,
452  UT_IntArray *&vec_indices);
453  static void getParmsCacheBehaviour( bool &set_keys,
454  bool &do_scope,
455  bool &append_scope );
456 
457  // Save the name of the state being created.
458  void saveStateToCreate(char const* state);
459 public:
460  static int cacheParms();
461  static void appendToParmsCache(OP_Node *op, PRM_Parm *parm,
462  int vi);
463  static void setParmsCacheBehaviour( bool set_keys, bool do_scope,
464  bool append_scope );
465 
467  { return theHideLockedHandleParts; }
468  static void setHideLockedHandleParts( bool hide )
469  { theHideLockedHandleParts = hide; }
470  static bool getScopeChannelsOnKey()
471  { return theScopeChannelsOnKey; }
472  static void setScopeChannelsOnKey( bool scope )
473  { theScopeChannelsOnKey = scope; }
474  static bool getAddScopedChannels()
475  { return theAddScopedChannels; }
476  static void setAddScopedChannels( bool add )
477  { theAddScopedChannels = add; }
479  { return theOpenChannelEditorOnScope; }
480  static void setOpenChannelEditorOnScope( bool do_open )
481  { theOpenChannelEditorOnScope = do_open; }
482  static void getChannelScopeCommandPrefix( UT_String &str );
483 
484 
485 protected:
486  // Classes:
487 
489  {
490  public:
491  PI_OpPIKey(const char *pi_name_in_setting_table, const char *pi_type,
492  int op_id) :
493  myPINameInSettingTable(pi_name_in_setting_table),
494  myPIType(pi_type),
495  myOpId(op_id) {}
496 
497  bool operator==(const PI_OpPIKey &o) const
498  {
499  // myPIType is not used.
500  return myPINameInSettingTable == o.myPINameInSettingTable &&
501  myOpId == o.myOpId;
502  }
503 
505  {
506  // myPIType is not used.
507  SYS_HashType hash = myPINameInSettingTable.hash();
508  SYShashCombine(hash, myOpId);
509  return hash;
510  }
511 
512  UT_StringHolder piNameInSettingTable() const { return myPINameInSettingTable; }
513  UT_StringHolder piType() const { return myPIType; }
514  int opId() const { return myOpId; }
515 
516  struct Hasher
517  {
518  size_t operator()(const PI_OpPIKey &pk) const { return size_t(pk.hash()); }
519  };
520 
521  private:
522  UT_StringHolder myPINameInSettingTable;
523  UT_StringHolder myPIType;
524  int myOpId;
525  };
526 
528  {
531  };
532 
533  // Methods:
534 
535  void installCommands();
536  void registerOpHandleLinks();
537  void registerCop2HandleLinks();
538  void registerOpHandleConstructors();
539  void registerSelectors();
540  void registerSelectorConstructors();
541 
542  // Functions used by registerOpHandleLinks for loading the OPbindings file.
543  bool isValidPiParmName( const UT_String &pi_name,
544  const UT_String &pi_parm);
545  void loadHandle(CPP_Manager &cppman, OP_Operator *op,
546  pi_OpHandleBinding *binding);
547  void loadSelector(CPP_Manager &cppman,
548  const UT_String &selname,
549  const UT_String &seldescription,
550  pi_OpSelectorBinding *binding);
551  void loadOperator(CPP_Manager &cppman,
552  const UT_String &oppath);
553  void loadOperator(CPP_Manager &cppman,
554  const UT_String &optype,
555  OP_Operator *op,
556  pi_OpHandleBinding *hbinding,
557  pi_OpSelectorBinding *sbinding);
558 
559  virtual void addAutomaticStates(PI_NetworkType net_type);
560  void tableUpdated(OP_OperatorTable *table) override;
561  void tableDeleted(OP_OperatorTable *table) override;
562  void templatesUpdated(OP_Operator *op) override;
563  void operatorDeleted(OP_Operator *op) override;
564  void ensureTableInterestExists(PI_NetworkType net_type,
566 
567  PI_HandleTemplate *getHandleTemplate(const char *handle_name) const;
568 
569  // Save all the PI settings to a stream.
570  static OP_ERROR savePIResourceManagerCallback(std::ostream &os,
571  void *data);
572  OP_ERROR saveSettings(std::ostream &os) const;
573 
574  // Save the non-persistent PI flagged as persistable to a stream
575  OP_ERROR save(std::ostream &os) const;
576 
577  // We need the non-const version of getDefaultPISettings() because we
578  // might need to sort the default settings.
579  const PI_SettingList *getDefaultPISettings(OP_Operator &op_type,
580  const char *type_name,
581  const char *description) const;
582  PI_SettingList *getDefaultPISettings(OP_Operator &op_type,
583  const char *type_name,
584  const char *description);
585 
586  // This method is implemented by the leaf class (i.e. MT_ResourceManager)
587  // and is used for updating the PI Settings (i.e. handle settings)
588  // loaded from the PI setting tables (loadPISettingsFromTables).
589  // MT_ResourceManager uses the latest PI settings registered by a
590  // python state to update the loaded settings.
591 
592  // pi_settings: The PI settings to update. The implementation should
593  // update it directly and return the same pointer.
594  // op: The owner operator.
595  // pi_type: The PI type name.
596  // pi_name: The PI description name.
597  virtual PI_SettingList const * onUpdatePISettings( PI_SettingList const& pi_settings,
598  OP_Operator & op,
599  char const* pi_type,
600  char const* pi_name) const;
601 
602  // Data:
603  using PI_SaveCallbackInfo = std::pair<PI_SaveCallback, void *>;
610 
613 
616 
620 
622  void* myCurrentPythonSupport = nullptr;
623 
624  static bool ourSetKeyOnParms;
625  static bool ourScopeParmChannels;
626  static bool ourAppendToScope;
627  static int ourCacheParms;
631 
634  static bool theAddScopedChannels;
636 };
637 
639 PI_API extern void PIcreateResourceManager(bool verbose=true);
640 PI_API extern bool PIresourceManagerExists();
641 
642 #endif
int operator==(const PI_BindingSelectorInfo &i) const
int operator==(const PI_BindingHandleInfo &i) const
const UT_String & getPrompt() const
UT_StringHolder piNameInSettingTable() const
Unsorted map container.
Definition: UT_Map.h:107
const PI_OpHandleLinkMap & getOpHandleLinks() const
UT_Array< PI_SaveCallbackInfo > mySaveCallbacks
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:623
PI_HandleTemplateMap myHandles
static bool theOpenChannelEditorOnScope
void
Definition: png.h:1083
GLboolean * data
Definition: glcorearb.h:131
const PI_SelectorTemplateMap & getSelectors() const
static UT_ValArray< OP_Node * > ourParmNodes
UT_StringArray myBuiltinOpHandleNames
UT_SymbolMap< pi_OpHandleBinding * > myOpHandleBindings
PI_API void PIcreateResourceManager(bool verbose=true)
static void setScopeChannelsOnKey(bool scope)
PI_OpHandleLinkMap myOpHandleLinks
PI_NetworkType
static bool getAddScopedChannels()
PI_ViewerType
PI_OpPIKey(const char *pi_name_in_setting_table, const char *pi_type, int op_id)
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
UT_ErrorSeverity
Definition: UT_Error.h:25
const PI_SettingList & getDefaultSettings() const
#define PI_API
Definition: PI_API.h:10
static void setOpenChannelEditorOnScope(bool do_open)
PI_API bool PIresourceManagerExists()
UT_StringHolder piType() const
void(* PI_SaveCallback)(void *data)
PI_SelectorTemplateMap mySelectors
const UT_String & getPIDescription() const
static bool theHideLockedHandleParts
bool operator==(const PI_OpPIKey &o) const
static bool theScopeChannelsOnKey
UT_SymbolMap< PI_NetworkType > myNetworkTypeTable
static UT_IntArray ourParmVecIndices
static bool ourScopeParmChannels
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size(){return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >);}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size< T, 0 >)};};template< typename T > struct subtype_count{static constexpr int value{is_mutable_container< T >::value?expected_max_vector_size:type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min{static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type >{static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min(){return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min(){return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >);}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size_min< T, 0 >)};};template< typename T > struct subtype_count_min{static constexpr int value{is_mutable_container< T >::value?((type_count< T >::value< expected_max_vector_size)?type_count< T >::value:0):type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count{static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type >{static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category:int{char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object{static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type >{static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type >{static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >{static constexpr object_category value{object_category::floating_point};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value >::type >{static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1)&&std::is_constructible< T, std::string >::value >::type >{static constexpr object_category value{object_category::string_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type{using type=typename std::conditional<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type >{static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type >{static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name(){return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >);}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name(){return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name(){auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >)}+ ','+tuple_name< T, I+1 >);if(str.back()== ',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
Definition: CLI11.h:1729
const UT_String & getOpParm() const
size_t operator()(const PI_OpPIKey &pk) const
static bool getHideLockedHandleParts()
const UT_String & getPrimMask() const
std::pair< PI_SaveCallback, void * > PI_SaveCallbackInfo
static bool getOpenChannelEditorOnScope()
static void setAddScopedChannels(bool add)
const UT_String & getExtraInfo() const
GLuint const GLchar * name
Definition: glcorearb.h:786
SYS_DECLARE_LEGACY_TR(GU_Detail)
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
static bool getScopeChannelsOnKey()
PI_API PI_ResourceManager * PIgetResourceManager()
static void setHideLockedHandleParts(bool hide)
static bool theAddScopedChannels
const UT_String & getPIName() const
const PI_HandleTemplateMap & getHandles() const
const PI_BindingParmArray & getBindings() const
const UT_String & getMenu() const
static bool ourSetKeyOnParms
UT_StringHolder myStateBeingCreated
UT_Map< PI_OpPIKey, OpPISettingInfo, PI_OpPIKey::Hasher > myPISettingsForOps
const UT_String & getDescription() const
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:119
UT_SymbolMap< pi_OpSelectorBinding * > myOpSelectorBindings
static UT_ValArray< PRM_Parm * > ourParms
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int operator==(const PI_BindingParmInfo &i) const
static bool ourAppendToScope
const UT_String & getName() const
type
Definition: core.h:1059
UT_StringMap< PI_SettingList * > myLastPISettings
const UT_String & getPIParm() const
Definition: format.h:895
const UT_String & getOpParm() const