369
|
1 #ifndef MEMLIST
|
|
2 #define MEMLIST
|
|
3
|
370
|
4 #include <stdlib.h>
|
368
|
5 #include "MemorySegment.h"
|
|
6
|
373
|
7 class MemList : public MemorySegment {
|
369
|
8 public:
|
370
|
9 MemorySegment* pool;
|
366
|
10 MemorySegment* first;
|
|
11 MemorySegment* last;
|
373
|
12
|
368
|
13 // TaskManager 側で create する
|
|
14 //MemList* createMemList(uint32 size, uint32 count);
|
373
|
15
|
368
|
16 MemList(MemorySegment* ms) {
|
373
|
17 first = last = this;
|
|
18 next = prev = this;
|
|
19 pool = ms;
|
370
|
20 }
|
|
21
|
|
22 ~MemList() {
|
373
|
23 free(pool);
|
368
|
24 }
|
366
|
25
|
|
26 void addFirst(MemorySegment* e);
|
|
27 void addLast(MemorySegment* e);
|
|
28 MemorySegment* getFirst();
|
|
29 MemorySegment* getLast();
|
368
|
30 int remove(MemorySegment* e);
|
370
|
31 MemorySegment* poll();
|
373
|
32 void moveToFirst(MemorySegment* e); // or use();
|
370
|
33 MemorySegment* get(int index);
|
368
|
34 };
|
|
35
|
369
|
36 #endif
|