ESyS-Particle  2.3
t_list.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 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.opensource.org/licenses/osl-3.0.php //
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 
Node< T > * End
Pointer to end of list.
Definition: t_list.h:44
T * Pop()
Definition: t_list.hpp:19
virtual ~List()
Definition: t_list.hpp:46
Definition: t_list.h:29
T * Get()
Definition: t_list.hpp:161
void InsertAfter(T *V)
Definition: t_list.hpp:119
List & operator+=(const List &L)
Definition: t_list.hpp:300
List & operator=(const List &L)
Definition: t_list.hpp:313
List operator+(const List &L)
Definition: t_list.hpp:292
void Put(T *V)
Definition: t_list.hpp:175
Definition: t_list.h:85
Node< T > * Next
Definition: t_list.h:32
void Next()
Definition: t_list.hpp:237
int SizeList()
Definition: t_list.hpp:55
Definition: t_list.h:40
Stack()
Definition: t_list.h:89
List & operator<<(T *V)
Definition: t_list.hpp:221
void Append(T *V)
Definition: t_list.hpp:95
List & operator>>(T *V)
Definition: t_list.hpp:229
void Prev()
Definition: t_list.hpp:243
void First()
Definition: t_list.hpp:249
T * Val
Definition: t_list.h:33
void Clear()
Definition: t_list.hpp:181
List< T > L
Definition: t_list.h:87
int IsStart()
Definition: t_list.hpp:267
void Swap()
Definition: t_list.hpp:273
int IsEnd()
Definition: t_list.hpp:261
void InsertBefore(T *V)
Definition: t_list.hpp:138
Node< T > * Start
Pointer to Start of list.
Definition: t_list.h:43
List()
Pointer to current position in the list.
Definition: t_list.hpp:27
Node< T > * Current
Definition: t_list.h:45
void Push(T *V)
Definition: t_list.hpp:14
void InsertAtStart(T *V)
Definition: t_list.hpp:71
Node< T > * Prev
Definition: t_list.h:32
void Last()
Definition: t_list.hpp:255
void Destroy()
Definition: t_list.hpp:214
virtual ~Stack()
Definition: t_list.h:90