HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GP_Node.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: Domain pasting Library (C++)
7  *
8  * COMMENTS: Paste node class.
9  *
10  */
11 
12 #ifndef __GP_Node_h__
13 #define __GP_Node_h__
14 
15 #include "GP_API.h"
16 #include "GP_NodeTree.h"
17 
18 
20 {
21 public:
22  // Class c-tors and d-tor
23  GP_Node(int akey = 0) { myKey = akey; }
24  GP_Node(const GP_Node &node) { myKey = node.myKey; }
25  virtual ~GP_Node(void); // clear node lists, but in/out nodes stay
26 
27  // Produce a brand new copy of ourselves. Must free it yourself.
28  // Does not copy our in and out nodes!
29  virtual GP_Node *copy(void) const;
30 
31  // Copy the in nodes and out-nodes from a pool of already built nodes:
32  // Return 0 if OK and -1 otherwise. Use with discretion.
33  virtual int copyInNodes (const GP_Node &src,
34  const GP_NodeTree &destpool);
35  virtual int copyOutNodes(const GP_Node &src,
36  const GP_NodeTree &destpool);
37 
38  // Create a a brand new object of the same type as us just using the
39  // default c-tor.
40  virtual GP_Node *newSpecies(void) const;
41 
42  // Remove the in or out edges and return the node address if found.
43  void removeInEdges (void);
44  void removeOutEdges(void);
45 
46  // Return the descendents or 0 if none. Must free the object yourself.
47  GP_NodeTree *descendents(void) const;
48 
49  // Return the in/out degree, ie the number of nodes in each list:
50  int inDegree (void) const { return myInNodes.entries ();}
51  int outDegree(void) const { return myOutNodes.entries();}
52 
53  // Query or set the key:
54  int key(void) const { return myKey; }
55  void key(int k) { myKey = k; }
56 
57  // Query or set the in and out node collections:
58  GP_NodeTree &inNodes (void) { return myInNodes; }
59  const GP_NodeTree &inNodes (void) const { return myInNodes; }
60  GP_NodeTree &outNodes(void) { return myOutNodes; }
61  const GP_NodeTree &outNodes(void) const { return myOutNodes; }
62 
63 private:
64  GP_NodeTree myInNodes;
65  GP_NodeTree myOutNodes;
66  int myKey;
67 };
68 
69 #endif
GP_NodeTree & inNodes(void)
Definition: GP_Node.h:58
#define GP_API
Definition: GP_API.h:10
void key(int k)
Definition: GP_Node.h:55
const GP_NodeTree & outNodes(void) const
Definition: GP_Node.h:61
int key(void) const
Definition: GP_Node.h:54
GP_Node(int akey=0)
Definition: GP_Node.h:23
int outDegree(void) const
Definition: GP_Node.h:51
const GP_NodeTree & inNodes(void) const
Definition: GP_Node.h:59
int inDegree(void) const
Definition: GP_Node.h:50
GP_Node(const GP_Node &node)
Definition: GP_Node.h:24
GP_NodeTree & outNodes(void)
Definition: GP_Node.h:60
GLenum src
Definition: glcorearb.h:1792