blob: be465983e202ca85a2f228d3162f96f134c2c4d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef __DATABASE_H__
#define __DATABASE_H__
#include "database-types.h"
#include "database-segment.h"
#include "database-internal.h"
class Database : public Base {
public:
Database() : start(0), end(0), currentId(1) { }
~Database() { while(start) delete start; }
DatabaseCell * getStart() { return start; }
DatabaseCell * getEnd() { return end; }
void setStart(DatabaseCell * newStart) { start = newStart; }
void setEnd(DatabaseCell * newEnd) { end = newEnd; }
Segment * getSegment(Uint32 id) {
DatabaseCell * cursor;
for (cursor = start; start; cursor = cursor->getNext())
if (cursor->getId() == id)
return cursor->getSegment();
return 0;
}
Uint32 GetNextSegId() { return currentId++; }
private:
DatabaseCell * start, * end;
Uint32 currentId;
};
#endif
|