source: git/libpolys/tests/cxxtest/LinkedList.h @ fa1598

fieker-DuValspielwiese
Last change on this file since fa1598 was 4aa8610, checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
created libpolys/tests and set up the beginning of a test-suite using cxxtest
  • Property mode set to 100644
File size: 1.2 KB
Line 
1#ifndef __cxxtest__LinkedList_h__
2#define __cxxtest__LinkedList_h__
3
4#include <cxxtest/Flags.h>
5
6namespace CxxTest
7{
8    struct List;
9    class Link;
10
11    struct List
12    {
13        Link *_head;
14        Link *_tail;
15
16        void initialize();
17
18        Link *head();
19        const Link *head() const;
20        Link *tail();
21        const Link *tail() const;
22
23        bool empty() const;
24        unsigned size() const;
25        Link *nth( unsigned n );
26
27        void activateAll();
28        void leaveOnly( const Link &link );
29    };
30
31    class Link
32    {       
33    public:
34        Link();
35        virtual ~Link();
36
37        bool active() const;
38        void setActive( bool value = true );
39
40        Link *justNext();
41        Link *justPrev();
42       
43        Link *next();
44        Link *prev();
45        const Link *next() const;
46        const Link *prev() const;
47
48        virtual bool setUp() = 0;
49        virtual bool tearDown() = 0;
50
51        void attach( List &l );
52        void detach( List &l );
53
54    private:
55        Link *_next;
56        Link *_prev;
57        bool _active;
58
59        Link( const Link & );
60        Link &operator=( const Link & );
61    };
62}
63
64#endif // __cxxtest__LinkedList_h__
65
Note: See TracBrowser for help on using the repository browser.