VitroIO SDK
Software development kit for Vitro Shard.
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1
#ifndef VITROIO_SDK_LIST_H
2
#define VITROIO_SDK_LIST_H
3
4
#include <cstddef>
5
6
namespace
vitroio
7
{
8
9
namespace
sdk
10
{
11
12
namespace
impl
13
{
14
15
template
<
typename
T>
16
struct
ListNode
17
{
18
T
value
;
19
ListNode
*
next
;
20
};
21
22
template
<
typename
T>
23
class
List
24
{
25
public
:
26
List
()
27
{
28
first_ = NULL;
29
last_ = NULL;
30
}
31
32
~List
()
33
{
34
ListNode<T>
* node = first_;
35
ListNode<T>
* nextNode;
36
while
(node != NULL){
37
nextNode = node->
next
;
38
delete
node;
39
node = nextNode;
40
}
41
}
42
43
bool
isEmpty
()
const
44
{
45
return
(first_ == NULL);
46
}
47
48
ListNode<T>
*
first
()
49
{
50
return
first_;
51
}
52
53
ListNode<T>
*
last
()
54
{
55
return
last_;
56
}
57
58
void
pushBack
(T value)
59
{
60
ListNode<T>
* tmpNode =
new
ListNode<T>
;
61
tmpNode->
value
= value;
62
tmpNode->
next
= NULL;
63
if
(
isEmpty
()){
64
first_ = tmpNode;
65
last_ = tmpNode;
66
}
67
else
{
68
last_->next = tmpNode;
69
last_ = tmpNode;
70
}
71
}
72
73
private
:
74
ListNode<T>
* first_;
75
ListNode<T>
* last_;
76
};
77
78
}
// namespace impl
79
80
}
// namespace sdk
81
82
}
// namespace vitroio
83
84
#endif
// VITROIO_SDK_LIST_H
vitroio::sdk::impl::List
Definition:
list.h:24
vitroio::sdk::impl::List::pushBack
void pushBack(T value)
Definition:
list.h:58
vitroio::sdk::impl::List::isEmpty
bool isEmpty() const
Definition:
list.h:43
vitroio::sdk::impl::List::first
ListNode< T > * first()
Definition:
list.h:48
vitroio::sdk::impl::List::List
List()
Definition:
list.h:26
vitroio::sdk::impl::List::last
ListNode< T > * last()
Definition:
list.h:53
vitroio::sdk::impl::List::~List
~List()
Definition:
list.h:32
vitroio
The namespace contains all of components of vitro-shard-sdk and components based on the sdk....
Definition:
can_layer.h:9
vitroio::sdk::impl::ListNode
Definition:
list.h:17
vitroio::sdk::impl::ListNode::next
ListNode * next
Definition:
list.h:19
vitroio::sdk::impl::ListNode::value
T value
Definition:
list.h:18
Vitro-SDK-Lib
vitroio-sdk
utils
impl
list.h
Generated by
1.9.5