//----------------------------------------------------------------------- void PagingLandScapeOctree::_removeNode(PagingLandScapeOctreeNode * n) { assert (!mNodes.empty()); NodeList::iterator it; it = std::find (mNodes.begin (), mNodes.end (), n); if (it != mNodes.end ()) mNodes.erase (it); if (n->isStaticNode ()) { it = std::find(mStaticNodes.begin (), mStaticNodes.end (), n); if (it != mStaticNodes.end ()) mStaticNodes.erase (it); } else { it = std::find(mMovingNodes.begin (), mMovingNodes.end (), n); if (it != mMovingNodes.end ()) mMovingNodes.erase (it); } n->setOctant(0); //update total counts. _unref(mNumNodes == 1); }
void Array::_ref(const Array& p_from) const { ArrayPrivate *_fp = p_from._p; ERR_FAIL_COND(!_fp); // should NOT happen. if (_fp == _p) return; //wathever it is, nothing to do here move along bool success = _fp->refcount.ref(); ERR_FAIL_COND(!success); //should really not happen either _unref(); if (_fp->shared) { _p = p_from._p; } else { _p = memnew( ArrayPrivate ); _p->shared=false; _p->refcount.init(); _p->array=_fp->array; if (_fp->refcount.unref()) memdelete(_fp); } }
void Octree::_removeNode( PCZSceneNode * n ) { mNodes.erase(n); ((OctreeZoneData*)n ->getZoneData(mZone))->setOctant( 0 ); //update total counts. _unref(); }
void Octree::_removeNode( OctreeNode * n ) { mNodes.erase( std::find( mNodes.begin(), mNodes.end(), n ) ); n -> setOctant( 0 ); //update total counts. _unref(); }
void Dictionary::_copy_on_write() const { //make a copy of what we have if (_p->shared) return; DictionaryPrivate *p = memnew(DictionaryPrivate); p->shared=_p->shared; p->variant_map=_p->variant_map; p->refcount.init(); _unref(); _p=p; }
void Dictionary::_ref(const Dictionary &p_from) const { //make a copy first (thread safe) if (!p_from._p->refcount.ref()) return; // couldn't copy //if this is the same, unreference the other one if (p_from._p == _p) { _p->refcount.unref(); return; } if (_p) _unref(); _p = p_from._p; }
void Array::_ref(const Array &p_from) const { ArrayPrivate *_fp = p_from._p; ERR_FAIL_COND(!_fp); // should NOT happen. if (_fp == _p) return; // whatever it is, nothing to do here move along bool success = _fp->refcount.ref(); ERR_FAIL_COND(!success); // should really not happen either _unref(); _p = p_from._p; }
Array::~Array() { _unref(); }
void label_unref(u_int16_t id) { _unref(&relay_labels, id); }
void tag_unref(u_int16_t id) { _unref(&relay_tags, id); }
void pftable_unref(u_int16_t id) { _unref(&pftable_labels, id); }
void rtlabel_unref(u_int16_t id) { _unref(&rt_labels, id); }
Dictionary::~Dictionary() { _unref(); }