+//
+// Basic object mesh maintainance
+//
+void NodeCore::parent(NodeCore &p)
+{
+ StLock<Mutex> _(*this);
+ mParent = &p;
+}
+
+void NodeCore::referent(NodeCore &r)
+{
+ StLock<Mutex> _(*this);
+ assert(!mReferent);
+ mReferent = &r;
+}
+
+void NodeCore::clearReferent()
+{
+ StLock<Mutex> _(*this);
+ if (mReferent)
+ assert(!mReferent->hasReference(*this));
+ mReferent = NULL;
+}
+
+
+void NodeCore::addReference(NodeCore &p)
+{
+ StLock<Mutex> _(*this);
+ assert(p.mReferent == this);
+ mReferences.insert(&p);
+}
+
+void NodeCore::removeReference(NodeCore &p)
+{
+ StLock<Mutex> _(*this);
+ assert(hasReference(p));
+ mReferences.erase(&p);
+}
+
+#if !defined(NDEBUG)
+
+bool NodeCore::hasReference(NodeCore &p)
+{
+ assert(p.refCountForDebuggingOnly() > 0);
+ return mReferences.find(&p) != mReferences.end();
+}
+
+#endif //NDEBUG
+
+