HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GP_NodeList.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: GP_NodeList.h (C++)
7  *
8  * COMMENTS: paste nodes stored in a linked list structure
9  *
10  *
11  */
12 
13 #ifndef __GP_NodeList_h__
14 #define __GP_NodeList_h__
15 
16 #include "GP_API.h"
17 #include <UT/UT_LinkList.h>
18 
19 class GP_NodeTree;
20 class GP_Node;
21 class gp_Node;
22 
24 {
25 public:
26  // Class c-tor and d-tor.
27  GP_NodeList(void) { myCrt = 0; }
28  GP_NodeList(const GP_NodeList &list); // shallow
29  virtual ~GP_NodeList(void); // does a clear(), not a clearAndDestroy()
30 
31  // Insert a node into the structure at the beginning or at the end.
32  // No duplicate checking is done.
33  void insert(const GP_Node &d);
34  void append(const GP_Node &d);
35 
36  // Remove a node from the structure and return its address if found.
37  const GP_Node *remove(void); // removes last
38  const GP_Node *remove(int key);
39  const GP_Node *remove(const GP_Node &d);
40 
41  // Search for a given node and return it if found. The search is by
42  // key, so the address might differ.
43  const GP_Node *find(int key) const;
44  const GP_Node *find(const GP_Node &d) const;
45 
46  // Inquire about a given node:
47  int contains(int key) const;
48  int contains(const GP_Node &d) const
49  {
50  return (find(d) != 0);
51  }
52 
53  // Clear the structure, or clear and destroy its GP_Node contents too:
54  void clear(void) { UT_LinkList::clear(); }
55  void clearAndDestroy(void);
56 
57  // Iterate through the list.
58  GP_Node *iterateInit(void);
59  GP_Node *iterateNext(void);
60 
61  // Convert the given tree to a *stack*, meaning that tree elements
62  // are *inserted* rather than appended.
63  GP_NodeList &operator=(const GP_NodeTree &tree);
64 
65  // Simple assignment operator that first clears us, then copies the
66  // nodes from source in a shallow manner (but our structure is unique).
67  GP_NodeList &operator=(const GP_NodeList &list);
68 
69 private:
70  gp_Node *myCrt;
71 };
72 
73 #endif
#define GP_API
Definition: GP_API.h:10
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
void clear(void)
Definition: GP_NodeList.h:54
int contains(const GP_Node &d) const
Definition: GP_NodeList.h:48
GP_NodeList(void)
Definition: GP_NodeList.h:27