summaryrefslogtreecommitdiff
path: root/Database/internals/database-references.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Database/internals/database-references.cpp')
-rw-r--r--Database/internals/database-references.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/Database/internals/database-references.cpp b/Database/internals/database-references.cpp
index 8520f16..c138698 100644
--- a/Database/internals/database-references.cpp
+++ b/Database/internals/database-references.cpp
@@ -1,47 +1,47 @@
-#include "database-references.h"
-
-RefFrom::RefFrom(RefTo * refTo, SegmentRefData * data) : refTo(refTo), data(data) {
- assert(refto);
- assert(data);
-
- next = data->getRefFrom();
- prev = 0;
- data->firstRefFrom = this;
- if (next)
- next->prev = this;
-}
-
-RefFrom::~RefFrom() {
- if (next)
- next->prev = prev;
- if (prev)
- prev->next = next;
- else
- data->setFirstRefFrom(next);
-}
-
-RefTo::RefTo(absolute_ptr ptr, SegmentRefData * data, Database * database) : data(data) {
- assert(database);
- Segment * destSeg = database->getSegment(ptr.segment_id);
- assert(destSeg);
- refFrom = new RefFrom(this, destSeg->getSegmentRefData(ptr.ptr);
-
- RefTo * t = data->getRefTo();
- if (t) {
- delete t;
- data->setRefTo(this);
- }
-}
-
-RefTo::~RefTo() {
- data->refTo = 0;
- delete refFrom;
-}
-
-SegmentRefData::SegmentRefData(Uint32 ptr, Segment * seg) : ptr(ptr), seg(seg) {
- seg->setSegmentRefData(ptr, this);
-}
-
-SegmentRefData::~SegmentRefData() {
- seg->setSegmentRefData(ptr, 0);
-}
+#include "database-references.h"
+
+RefFrom::RefFrom(RefTo * refTo, SegmentRefData * data) : refTo(refTo), data(data) {
+ assert(refto);
+ assert(data);
+
+ next = data->getRefFrom();
+ prev = 0;
+ data->firstRefFrom = this;
+ if (next)
+ next->prev = this;
+}
+
+RefFrom::~RefFrom() {
+ if (next)
+ next->prev = prev;
+ if (prev)
+ prev->next = next;
+ else
+ data->setFirstRefFrom(next);
+}
+
+RefTo::RefTo(absolute_ptr ptr, SegmentRefData * data, Database * database) : data(data) {
+ assert(database);
+ Segment * destSeg = database->getSegment(ptr.segment_id);
+ assert(destSeg);
+ refFrom = new RefFrom(this, destSeg->getSegmentRefData(ptr.ptr);
+
+ RefTo * t = data->getRefTo();
+ if (t) {
+ delete t;
+ data->setRefTo(this);
+ }
+}
+
+RefTo::~RefTo() {
+ data->refTo = 0;
+ delete refFrom;
+}
+
+SegmentRefData::SegmentRefData(Uint32 ptr, Segment * seg) : ptr(ptr), seg(seg) {
+ seg->setSegmentRefData(ptr, this);
+}
+
+SegmentRefData::~SegmentRefData() {
+ seg->setSegmentRefData(ptr, 0);
+}