diff options
Diffstat (limited to 'Database/internals/database-internal.cpp')
-rw-r--r-- | Database/internals/database-internal.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Database/internals/database-internal.cpp b/Database/internals/database-internal.cpp new file mode 100644 index 0000000..0c90b71 --- /dev/null +++ b/Database/internals/database-internal.cpp @@ -0,0 +1,27 @@ +#include "database-internal.h"
+
+DatabaseCell::DatabaseCell(Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, DatabaseCell * prev, Database * parent) : cpu(cpu), next(0), prev(prev), parent(parent) {
+ prev->next = this;
+ parent->setEnd(this);
+ if (origin) {
+ Segment * origin_seg = parent->GetSegment(SEGID(origin));
+ segment = new Segment(size, cpu_base, parent->GetNextSegId(), extra_size, origin_seg->getPristineMemory() + SEGOFFSET(origin));
+ } else {
+ segment = new Segment(size, cpu_base, parent->GetNextSegId(), extra_size);
+ }
+}
+
+DatabaseCell::~DatabaseCell() {
+ if (parent->getEnd() == this)
+ parent->setEnd(prev);
+
+ if (parent->getStart() == this)
+ parent->setStart(next);
+
+ if (next)
+ next->prev = prev;
+ if (prev)
+ prev->next = next;
+
+ delete segment;
+}
|