Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FaceList.hpp
Go to the documentation of this file.
1 #ifndef FACELIST_HPP
2 #define FACELIST_HPP
3 
4 #include "general.hpp"
5 #include "Face.hpp"
6 
7 class FaceList {
8 public:
9 
10  FaceList();
11  FaceList( const FaceList& olist );
12  ~FaceList();
13 
14  const FaceList& operator=( const FaceList& olist);
15 
16  void append(Face* val);
17  void insert(Face* val);
18  void insert_first(Face* val);
19 
20  void reset();
21  void next();
22 
23  Face* get();
24  Face* remove();
25 
26  boolean empty();
27  int size();
28 
29  boolean move_to(Face* 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(Face* 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 FaceList::insert(Face* 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 FaceList::Elem( val );
64  return;
65  }
66  d_current->d_next = new Elem( val, d_current->d_next);
67 }
68 
69 inline void FaceList::insert_first(Face* val) { // at d_current
70  d_size++;
71  d_first = new FaceList::Elem( val, d_first);
73 }
74 
75 
76 inline void FaceList::reset() {
78 }
79 
80 inline void FaceList::next() {
82  if( !d_current ){
84  }
85 }
86 
87 inline Face* FaceList::get() {
88  return d_current->d_val;
89 }
90 
91 inline boolean FaceList::empty(){
92  return ( d_size <= 0 ? TRUE : FALSE);
93 }
94 
95 inline int FaceList::size(){
96  return d_size;
97 }
98 
99 
100 #endif
101 
102 
103 
104 
#define FALSE
Definition: vinci.h:133
const FaceList & operator=(const FaceList &olist)
Definition: FaceList.cpp:35
Elem * d_next
Definition: FaceList.hpp:37
int size()
Definition: FaceList.hpp:95
int index() const
Definition: FaceList.cpp:110
FaceList()
Definition: FaceList.cpp:5
Elem(Face *val, Elem *next=0)
Definition: FaceList.hpp:40
Elem * d_current
Definition: FaceList.hpp:49
void next()
Definition: FaceList.hpp:80
Face * d_val
Definition: FaceList.hpp:36
#define TRUE
Definition: vinci.h:134
void reset()
Definition: FaceList.hpp:76
void append(Face *val)
Definition: FaceList.cpp:58
~FaceList()
Definition: FaceList.cpp:31
Elem * d_first
Definition: FaceList.hpp:48
boolean move_to(Face *val)
Definition: FaceList.cpp:102
Face * get()
Definition: FaceList.hpp:87
void insert(Face *val)
Definition: FaceList.hpp:55
int d_size
Definition: FaceList.hpp:51
boolean empty()
Definition: FaceList.hpp:91
The Face class is an abstract base class that supplies implemented general methods, as well as a vew virtual interface methods to child classes.
Definition: Face.hpp:19
void insert_first(Face *val)
Definition: FaceList.hpp:69