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
|
#include "database-internal.h"
#include "database.h"
DatabaseCell::DatabaseCell(Database * parent, Cpu * cpu, Uint64 cpu_base, absolute_ptr origin, Uint32 size, Uint32 extra_size, const Byte * data) : cpu(cpu), next(0), parent(parent) {
prev = parent->getEnd();
if (prev)
prev->next = this;
parent->setEnd(this);
if (origin.raw_ptr) {
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, data);
}
}
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;
}
|