HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PI_Manager.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_Manager.h.h ( PI Library, C++)
7  *
8  * COMMENTS:
9  *
10  * Manager to update/remove/add PIs and bindings.
11  */
12 
13 #ifndef __PI_Manager__
14 #define __PI_Manager__
15 
16 #include "PI_API.h"
17 #include <UT/UT_Pair.h>
18 #include <UT/UT_IntArray.h>
19 #include <UT/UT_Array.h>
20 #include <OP/OP_Error.h>
21 #include <iosfwd>
22 #include "PI_OHLGroup.h"
23 
24 typedef enum {
37 
39  PI_ChangeType ctype,
40  void *data);
41 typedef void (*PI_GroupCallback)(PI_OHLGroup *group,
42  PI_ChangeType ctype,
43  void *data);
44 
45 class OP_Node;
46 class PI_OpHandleLink;
47 
49 
51 {
52 public:
53  UT_String getFreePIName(const char *name) const;
54  int addPI(const char *name, const PI_OpHandleLink *refpi);
55  int addPI(const char *name, const char *pitype);
56  void removePI(PI_OHLPersistent *pi);
57  void removeAllPIs();
58  int getPIIndex(const char *name) const;
59  int getPIIndex(const PI_OpHandleLink &pi) const;
60  int getNumPIs() const;
61  PI_OHLPersistent *getPI(int index) const;
62  void swapPIs(int idx1, int idx2);
63 
64  UT_String getFreeGroupName(const char *name) const;
65  int addGroup(const char *name);
66  void removeGroup(PI_OHLGroup *group);
67  int getGroupIndex(const char *name) const;
68  int getNumGroups() const;
69  PI_OHLGroup *getGroup(int index) const;
70  void swapGroups(int idx1, int idx2);
71 
72  void addPItoGroup(int pi, int group);
73  void removePIfromGroup(int pi, int group);
74  void clearGroup(int group);
75 
76  void addPICallback(PI_PICallback cb, void *data);
77  void removePICallback(PI_PICallback cb, void *data);
78  void piChanged(PI_OHLPersistent *pi,
79  PI_ChangeType ctype) const;
80  void addGroupCallback(PI_GroupCallback cb, void *data);
81  void removeGroupCallback(PI_GroupCallback cb, void *data);
82  void groupChanged(PI_OHLGroup *group,
83  PI_ChangeType ctype) const;
84 
85  OP_ERROR savePersistentPIs(std::ostream &os, int i = -1) const;
86  OP_ERROR savePersistentGroups(std::ostream &os, int i = -1) const;
87 
88  // This function is used when collapsing or extracting subnets.
89  // It takes all references to the "from" ops and changes them to
90  // refer to the corresponding "to" op.
91  void getRefreshPICommands(std::ostream &commands,
92  UT_ValArray<OP_Node *> &fromOps,
93  UT_ValArray<OP_Node *> &toOps);
94  void getRefreshPICommands(std::ostream &commands, OP_Node *op);
95 
96 private:
97  PI_Manager();
98  virtual ~PI_Manager();
99 
100  void installCommands() const;
101  void deinstallCommands() const;
102  void addPIsWithOp(OP_Node &node, UT_IntArray &pis) const;
103 
104  static OP_ERROR savePIManagerCallback(std::ostream &os, void *data);
105 
108 
109  PI_OHLGroup myAllGroup;
110  UT_ValArray<PI_OHLGroup *> myOHLGroups;
111  UT_Array<PI_PICallbackInfo> myPICallbacks;
112  UT_Array<PI_GroupCallbackInfo> myGroupCallbacks;
113 
114  friend PI_API PI_Manager *PIgetManager();
115 };
116 
117 #endif
118 
PI_API PI_Manager * PIgetManager()
PI_ChangeType
Definition: PI_Manager.h:24
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
UT_ErrorSeverity
Definition: UT_Error.h:25
#define PI_API
Definition: PI_API.h:10
png_uint_32 i
Definition: png.h:2877
void(* PI_PICallback)(PI_OHLPersistent *pi, PI_ChangeType ctype, void *data)
Definition: PI_Manager.h:38
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
void(* PI_GroupCallback)(PI_OHLGroup *group, PI_ChangeType ctype, void *data)
Definition: PI_Manager.h:41
GLuint index
Definition: glcorearb.h:785