summaryrefslogtreecommitdiff
path: root/Database/database.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2009-09-21 01:52:53 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2009-09-21 01:52:53 +0200
commit2fa3e53855dd12c13560dbe7da19eac7b90a3b29 (patch)
tree636feb35d4f28d4527501310f2f63994b170d466 /Database/database.h
parent1f7ca9fd3964481318bbaddfb39acc5de8c7d65d (diff)
Adding more skeletons
Diffstat (limited to 'Database/database.h')
-rw-r--r--Database/database.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/Database/database.h b/Database/database.h
index dffaaf5..be46598 100644
--- a/Database/database.h
+++ b/Database/database.h
@@ -7,16 +7,24 @@
class Database : public Base {
public:
- Database();
- ~Database();
+ 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);
- Uint32 GetNextSegId();
+ 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