Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NodeList.hpp
Go to the documentation of this file.
1 #ifndef NODELIST_HPP
2 #define NODELIST_HPP
3 
4 #include "general.hpp"
5 #include "Node.hpp"
6 
7 class NodeList {
8 public:
9 
10  NodeList();
11  NodeList( const NodeList& olist );
12  ~NodeList();
13 
14  const NodeList& operator=( const NodeList& olist);
15 
16  void append(Node* val);
17  void insert(Node* val);
18  void insert_first(Node* val);
19 
20  void reset();
21  void next();
22 
23  Node* get();
24  Node* remove();
25 
26  boolean empty();
27  int size();
28 
29  boolean move_to(Node* val);
30  int index() const;
31  void index( int ind );
32 
33 private:
34 
35  struct Elem {
38 
39  Elem() : d_val(0), d_next(0) {}
40  Elem(Node* val, Elem* next = 0) :
41  d_val(val), d_next(next) {}
42 
43  ~Elem() {
44  if( d_next ) delete d_next;
45  }
46  };
47 
50 
51  int d_size;
52 };
53 
54 
55 inline void NodeList::insert(Node* val) { // at d_current
56  if( !d_current && d_first){
57  cerr << " Gevalt - insert\n";
58  return;
59  }
60  d_size++;
61  if( !d_current ){
62  d_first = new NodeList::Elem( val );
64  return;
65  }
66  d_current->d_next = new Elem( val, d_current->d_next);
67 }
68 
69 inline void NodeList::insert_first(Node* val) { // at d_current
70  d_size++;
71  d_first = new NodeList::Elem( val, d_first);
73 }
74 
75 
76 inline void NodeList::reset() {
78 }
79 
80 inline void NodeList::next() {
82  if( !d_current ){
84  }
85 }
86 
87 inline Node* NodeList::get() {
88  return d_current->d_val;
89 }
90 
91 inline boolean NodeList::empty(){
92  return ( d_size <= 0 ? TRUE : FALSE);
93 }
94 
95 inline int NodeList::size(){
96  return d_size;
97 }
98 
99 
100 #endif
101 
102 
103 
104 
#define FALSE
Definition: vinci.h:133
int size()
Definition: NodeList.hpp:95
~NodeList()
Definition: NodeList.cpp:31
void next()
Definition: NodeList.hpp:80
This class encapsulate a node over a window manifold.
Definition: Manifold_2.h:370
Node * get()
Definition: NodeList.hpp:87
Node * d_val
Definition: NodeList.hpp:36
const NodeList & operator=(const NodeList &olist)
Definition: NodeList.cpp:35
void insert(Node *val)
Definition: NodeList.hpp:55
Elem * d_next
Definition: NodeList.hpp:37
Elem(Node *val, Elem *next=0)
Definition: NodeList.hpp:40
void reset()
Definition: NodeList.hpp:76
#define TRUE
Definition: vinci.h:134
Elem * d_first
Definition: NodeList.hpp:48
void append(Node *val)
Definition: NodeList.cpp:58
int index() const
Definition: NodeList.cpp:110
Elem * d_current
Definition: NodeList.hpp:49
boolean empty()
Definition: NodeList.hpp:91
NodeList()
Definition: NodeList.cpp:5
int d_size
Definition: NodeList.hpp:51
boolean move_to(Node *val)
Definition: NodeList.cpp:102
void insert_first(Node *val)
Definition: NodeList.hpp:69