Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1
#ifndef ULT_NODE_H_INCLUDED
2
#define ULT_NODE_H_INCLUDED
3
4
namespace
Ult
5
{
6
11
class
Node
12
{
13
public
:
17
Node
() :
18
mNext
(nullptr),
19
mPrev
(nullptr),
20
mChild
(nullptr)
21
{}
22
25
virtual
~Node
() {
26
mPrev
=
nullptr
;
27
if
(
mChild
) {
28
delete
mChild
;
29
mChild
=
nullptr
;
30
}
31
if
(
mNext
) {
32
delete
mNext
;
33
mNext
=
nullptr
;
34
}
35
}
36
40
void
AddChild
(
Node
* node) {
41
if
(
mChild
==
nullptr
) {
42
mChild
= node;
43
}
else
{
44
mChild
->AddSibling(node);
45
}
46
}
47
50
void
AddSibling
(
Node
* node) {
51
Node
* ptr =
mNext
;
52
if
(
mNext
==
nullptr
) {
53
mNext
= node;
54
node->
mPrev
=
this
;
55
}
else
{
56
while
(ptr->
mNext
) {
57
ptr = ptr->
mNext
;
58
}
59
ptr->
mNext
= node;
60
node->
mPrev
= ptr;
61
}
62
}
63
67
virtual
void
Process
() {
68
if
(
mChild
) {
69
mChild
->Process();
70
}
71
if
(
mNext
) {
72
mNext
->Process();
73
}
74
}
75
protected
:
76
Node
*
mNext
;
77
Node
*
mPrev
;
78
Node
*
mChild
;
79
};
80
81
}
// namespace Ult
82
83
#endif
// ULT_NODE_H_INCLUDED
84
Ult::Node::Node
Node()
Definition
Node.h:17
Ult::Node::~Node
virtual ~Node()
Definition
Node.h:25
Ult::Node::mNext
Node * mNext
Definition
Node.h:76
Ult::Node::mPrev
Node * mPrev
Definition
Node.h:77
Ult::Node::AddSibling
void AddSibling(Node *node)
Definition
Node.h:50
Ult::Node::mChild
Node * mChild
Definition
Node.h:78
Ult::Node::Process
virtual void Process()
Definition
Node.h:67
Ult::Node::AddChild
void AddChild(Node *node)
Definition
Node.h:40
Ult
Definition
Archive.h:13
include
Ult
Node.h
Generated by
1.13.0