source:
orxonox.OLD/orxonox/trunk/src/list.h
@
2816
Last change on this file since 2816 was 2816, checked in by patrick, 20 years ago | |
---|---|
File size: 931 bytes |
Rev | Line | |
---|---|---|
[2636] | 1 | |
[2036] | 2 | #ifndef LIST_H |
3 | #define LIST_H | |
4 | ||
[2816] | 5 | #include "stdincl.h" |
[2036] | 6 | |
[2077] | 7 | //! An enum to list all the modes available when adding an object to a List |
[2816] | 8 | //enum ADDMODE {LIST_ADD_FIRST, LIST_ADD_LAST}; |
[2077] | 9 | //! An enum to list the two searching directions available when removing an object from a List |
[2816] | 10 | //enum FINDMODE {LIST_FIND_BW, LIST_FIND_FW}; |
[2036] | 11 | |
12 | ||
[2077] | 13 | |
[2816] | 14 | class WorldEntity; |
[2036] | 15 | |
[2816] | 16 | class List { |
[2036] | 17 | |
[2816] | 18 | public: |
19 | List (); | |
20 | ~List (); | |
[2036] | 21 | |
[2816] | 22 | void add(WorldEntity* entity); |
23 | void remove(WorldEntity* entity); | |
24 | void clear(); | |
25 | WorldEntity* firstElement(); | |
26 | bool isEmpty(); | |
27 | int getSize(); | |
28 | WorldEntity* enumerate(); | |
29 | WorldEntity* nextElement(); | |
30 | WorldEntity* toArray(); | |
31 | void debug(); | |
[2077] | 32 | |
[2816] | 33 | private: |
34 | struct listElement | |
[2077] | 35 | { |
[2816] | 36 | listElement* prev; |
37 | WorldEntity* curr; | |
38 | listElement* next; | |
39 | }; | |
40 | Uint32 size; | |
41 | listElement* first; | |
42 | listElement* last; | |
43 | listElement* currentEl; | |
[2077] | 44 | |
45 | ||
[2816] | 46 | }; |
[2077] | 47 | |
[2816] | 48 | class Iterator |
[2077] | 49 | { |
50 | ||
[2816] | 51 | public: |
52 | bool hasNext(); | |
53 | WorldEntity* next(); | |
[2077] | 54 | |
[2816] | 55 | private: |
[2077] | 56 | |
[2816] | 57 | }; |
58 | ||
[2036] | 59 | #endif |
Note: See TracBrowser
for help on using the repository browser.