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