ESyS-Particle  2.3.4
t_list.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
12 
13 #ifndef _T_LIST_H_
14 #define _T_LIST_H_
15 #include <string.h>
16 #ifndef NULL
17 #define NULL 0
18 #endif
19 
20 #ifdef _LINUX
21 #include <stddef.h>
22 #endif
23 
24 #ifdef _DEBUG
25 #include "console.h"
26 #endif
27 
28 template<class T>
29 class Node
30 {
31 public:
33  T *Val ;
34 } ;
35 
39 template <class T>
40 class List
41  {
42  protected:
46  public:
47  inline List() ;
48  inline List(const List &L) ;
49  virtual ~List() ;
50 
51  inline void Swap() ;
52  inline void InsertAtStart(T *V) ;
53  inline void Append(T *V) ;
54  inline void InsertAfter(T *V) ;
55  inline void InsertBefore(T *V) ;
56  inline T* Get() ;
57  inline void Put(T *V) ;
58 
59  inline void Clear() ;
60  inline void Destroy() ;
61 
62  inline List& operator << (T *V) ;
63  inline List& operator >> (T *V) ;
64 
65  inline void Next() ;
66  inline void Prev() ;
67  inline void First() ;
68  inline void Last() ;
69 
70  inline int IsEnd() ;
71  inline int IsStart() ;
72 
73  inline int SizeList() ;
74 
75  inline List operator + (const List& L) ;
76  inline List& operator += (const List& L) ;
77  inline List& operator = (const List& L) ;
78  } ;
79 
80 
84 template< class T>
85 class Stack {
86  protected:
88  public:
89  inline Stack() {} ;
90  virtual ~Stack() { L.Destroy() ; } ;
91 
92  inline void Push(T* V) ;
93 
94  inline T* Pop() ;
95 } ;
96 
97 #if 0
98 
102 template <class T>
103 class ListWS: public List<T> {
104  protected:
105  Stack<Node<T> > stack ;
106  public:
107  inline ListWS() : List<T>() {} ;
108  inline ListWS(const ListWS &L) : List<T>(L) { } ;
109  virtual ~ListWS() { } ;
110 
111  inline void PushPos() ;
112  inline void PopPos() ;
113 } ;
114 #endif
115 #include "t_list.hpp"
116 
117 #endif
118 
List::IsEnd
int IsEnd()
Definition: t_list.hpp:261
Stack::Pop
T * Pop()
Definition: t_list.hpp:19
Node::Next
Node< T > * Next
Definition: t_list.h:32
List::Get
T * Get()
Definition: t_list.hpp:161
List::List
List()
Pointer to current position in the list.
Definition: t_list.hpp:27
Stack::~Stack
virtual ~Stack()
Definition: t_list.h:90
List::InsertAfter
void InsertAfter(T *V)
Definition: t_list.hpp:119
List::Start
Node< T > * Start
Pointer to Start of list.
Definition: t_list.h:43
List::~List
virtual ~List()
Definition: t_list.hpp:46
List::operator>>
List & operator>>(T *V)
Definition: t_list.hpp:229
console.h
List::First
void First()
Definition: t_list.hpp:249
List::Next
void Next()
Definition: t_list.hpp:237
List::End
Node< T > * End
Pointer to end of list.
Definition: t_list.h:44
List::SizeList
int SizeList()
Definition: t_list.hpp:55
List::operator+
List operator+(const List &L)
Definition: t_list.hpp:292
List::operator=
List & operator=(const List &L)
Definition: t_list.hpp:313
List::operator+=
List & operator+=(const List &L)
Definition: t_list.hpp:300
List::Append
void Append(T *V)
Definition: t_list.hpp:95
List::IsStart
int IsStart()
Definition: t_list.hpp:267
Node::Prev
Node< T > * Prev
Definition: t_list.h:32
List::Clear
void Clear()
Definition: t_list.hpp:181
List::Prev
void Prev()
Definition: t_list.hpp:243
Stack::Stack
Stack()
Definition: t_list.h:89
Node
Definition: t_list.h:30
Stack::L
List< T > L
Definition: t_list.h:87
t_list.hpp
List::InsertBefore
void InsertBefore(T *V)
Definition: t_list.hpp:138
List::operator<<
List & operator<<(T *V)
Definition: t_list.hpp:221
List::Current
Node< T > * Current
Definition: t_list.h:45
List::Destroy
void Destroy()
Definition: t_list.hpp:214
List::InsertAtStart
void InsertAtStart(T *V)
Definition: t_list.hpp:71
List::Swap
void Swap()
Definition: t_list.hpp:273
List
Definition: t_list.h:41
Stack
Definition: t_list.h:85
Stack::Push
void Push(T *V)
Definition: t_list.hpp:14
List::Last
void Last()
Definition: t_list.hpp:255
List::Put
void Put(T *V)
Definition: t_list.hpp:175
Node::Val
T * Val
Definition: t_list.h:33