From 2fa3e53855dd12c13560dbe7da19eac7b90a3b29 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 21 Sep 2009 01:52:53 +0200 Subject: Adding more skeletons --- Database/database.h | 16 ++++++++++++---- Database/internals/database-internal.h | 3 ++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'Database') 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 diff --git a/Database/internals/database-internal.h b/Database/internals/database-internal.h index 5ca6050..173eb62 100644 --- a/Database/internals/database-internal.h +++ b/Database/internals/database-internal.h @@ -21,12 +21,13 @@ class DatabaseCell : public Base { */ DatabaseCell(Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, DatabaseCell * prev, Database * parent); ~DatabaseCell(); - Uint32 getID() { return segment->getId(); } + Uint32 getId() { return segment->getId(); } void LoadMemory(Handle * src) { segment->LoadMemory(src); } Segment * getSegment() { return segment; } Cpu * getCpu() { return cpu; } Uint64 getCpuBase() { return segment->getCpuBase(); } absolute_ptr getOrigin() { return origin; } + DatabaseCell * getNext() { return next; } private: Segment * segment; -- cgit v1.2.3