HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Channels.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: OP_Channels.h (C++)
7  *
8  * COMMENTS: OP_Channels is a channel collection used by an OP_Node
9  * object. This class implements the pure virtuals defined
10  * in CH_Collection to access local variables and the channel
11  * collection hierarchy.
12  *
13  * there are two uses of this class
14  * 1: as a channel holder for each OP_Node
15  * 2: as a channel holder to do copying and pasting
16  *
17  * appropriate methods/variables are marked accordingly
18  * this should be two or three classes maybe, but there is no
19  * reason to do this now.
20  *
21  */
22 
23 #ifndef __OP_Channels__
24 #define __OP_Channels__
25 
26 #include "OP_API.h"
27 #include <CH/CH_Collection.h>
28 #include <CH/CH_EventManager.h>
29 #include <CH/CH_Types.h>
30 #include <UT/UT_StringHolder.h>
31 #include <SYS/SYS_Types.h>
32 
33 
34 class OP_Node;
35 class CH_Channel;
36 class CH_LocalVariable;
37 class CH_Manager;
38 class UT_String;
39 class UT_XformOrder;
40 
41 
43 {
44 public:
45  OP_Channels(OP_Node *owner, CH_Manager *chman,
46  CH_LocalVariable *vars);
47  virtual ~OP_Channels();
48 
49  virtual int64 getMemoryUsage(bool inclusive) const;
50 
51  // PATH/ID RELATED (1)
52  // these functions rely on the one-to-one mapping between
53  // OP_Node and OP_Channels
54  virtual const UT_String &getName() const;
55 
56  virtual int getUniqueId() const;
57  virtual CH_Collection * lookupCollection(int id) const;
58 
59  virtual const CH_Collection *getParent() const;
60  virtual CH_Collection *getParent();
61  virtual const CH_Collection *getChild(const char *name) const;
62  virtual CH_Collection *getChild(const char *name);
63  virtual const void *getOwner() const;
64  virtual void *getOwner();
65 
66  virtual int getChildren(CH_NameList &names) const;
67  virtual int getChildren(CH_CollectionList &grps) const;
68 
69  virtual UT_StringHolder getFullPath() const;
70  virtual CH_Collection *findCollection(const char *name) const;
71 
72  // EVENTS (1)
73  virtual void setChanged(CH_CHANGE_TYPE how, void *data=0);
74 
75  // CHANNEL EVALUATION (1 & 2)
76  OP_Node *getNode() const { return myOwner; }
77  void setNode(OP_Node *new_owner);
78 
79  virtual bool getVariableValue(fpreal &val, int table, int index,
80  int thread);
81  virtual bool getVariableValue(UT_String &str, int table, int index,
82  int thread);
83 
84  enum { OP_VARIABLE_TABLE_INDEX = 4 };
85 
86  virtual const CH_LocalVariable *resolveVariable(const char *name, int &tab);
87  const CH_LocalVariable *resolveExtraVariableForSyntaxHighlight(
88  const char *name);
89 
90  virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const;
91 
92  // CHANNEL BUFFER STUFF (2)
93  // this sets the node so that contained channels can evaluate channel
94  // references as if they are in the same node as target
95  void setTargetChannel( const CH_Channel *target ) const;
96 
97  // UTILITIES (1)
98  virtual int canAccess(unsigned mask) const;
99  virtual int canAccessChannel(uint mask,
100  const CH_Channel *chp) const;
101  virtual void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime);
102 
103  virtual void addLocalVarDependency(int table, int index,
104  void *ref_id);
105 
106  virtual OP_Channels *castToOPChannels() { return this; }
107  virtual const OP_Channels *castToOPChannels() const { return this; }
108 
109 protected:
110 
111  virtual void notifyChannelRenameDependents(const char *old_name,
112  const char *new_name);
113 
114 private:
115  OP_Node *myOwner; // (1 & 2)
116 };
117 
118 #endif
virtual const CH_LocalVariable * resolveVariable(const char *name, int &tab)
virtual int canAccess(uint mask) const
OP_Node * getNode() const
Definition: OP_Channels.h:76
virtual bool getVariableValue(UT_String &str, int table, int index, int thread)
virtual int canAccessChannel(uint mask, const CH_Channel *chp) const
GLint GLuint mask
Definition: glcorearb.h:123
virtual CH_Collection * findCollection(const char *path) const =0
virtual const CH_Collection * getChild(const char *name) const =0
virtual CH_Collection * lookupCollection(int id) const
virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const
virtual const CH_Collection * getParent() const =0
virtual const OP_Channels * castToOPChannels() const
Definition: OP_Channels.h:107
virtual int64 getMemoryUsage(bool inclusive) const
long long int64
Definition: SYS_Types.h:107
CH_CHANGE_TYPE
virtual int getChildren(CH_NameList &names) const =0
virtual UT_StringHolder getFullPath() const =0
GLenum target
Definition: glcorearb.h:1666
virtual const void * getOwner() const =0
virtual OP_Channels * castToOPChannels()
Definition: OP_Channels.h:106
virtual int getUniqueId() const
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual const UT_String & getName() const =0
unsigned int uint
Definition: SYS_Types.h:40
double fpreal
Definition: SYS_Types.h:270
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:785
GLuint GLfloat * val
Definition: glcorearb.h:1607
virtual void notifyChannelRenameDependents(const char *old_name, const char *new_name)
virtual void setChanged(CH_CHANGE_TYPE how, void *data=nullptr)
virtual void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime)=0
virtual void addLocalVarDependency(int table, int index, void *ref_id)