27 template class ::IceInternal::Handle<::armarx::TermImpl>;
37 void TermImpl::addChild(
const TermImplBasePtr& child,
const Ice::Current&
c)
39 child->setParent(
this);
41 childs.push_back(child);
44 TermImplSequence TermImpl::getChilds(
const Ice::Current&
c)
49 TermImplBasePtr TermImpl::getParent(
const Ice::Current&
c)
54 bool TermImpl::getValue(
const Ice::Current&
c)
const
61 return datafieldValues;
64 TermType TermImpl::getType(
const Ice::Current&
c)
const
77 void TermImpl::updateWithData(
const Ice::Current&
c)
81 parent->updateWithData();
85 void TermImpl::removeChildren()
88 TermImplSequence::iterator iterChilds = childs.begin();
90 while (iterChilds != childs.end())
94 (*iterChilds)->resetParent();
97 childs.erase(iterChilds);
98 iterChilds = childs.begin();
102 this->childs.clear();
105 void TermImpl::setParent(
const TermImplBasePtr& parent,
const Ice::Current&
c)
107 this->parent = parent;
110 void TermImpl::resetParent(
const Ice::Current&
c)
115 int TermImpl::atomicDecAndTestValue(
volatile int* counter,
int value)
118 __asm__ __volatile__(
119 "lock ; decl %0; sete %1"
120 :
"=m"(*counter),
"=qm"(
c)
121 :
"m"(*counter) :
"memory");
125 void TermImpl::__incRef()
130 void TermImpl::__decRef()
133 int numberChilds = int(childs.size());
135 assert(InterlockedExchangeAdd(&_ref, 0) > 0);
137 if (InterlockedDecrement(&_ref) == numberChilds && !_noDelete)
143 #elif defined(ICE_HAS_GCC_BUILTINS)
144 int c = __sync_fetch_and_sub(&_ref, 1);
147 if ((
c == numberChilds + 1) && !_noDelete)
153 #elif defined(ICE_HAS_ATOMIC_FUNCTIONS)
154 assert(IceUtilInternal::atomicExchangeAdd(&_ref, 0) > 0);
156 if (IceUtilInternal::atomicDecAndTestValue(&_ref, numberChilds) && !_noDelete)
161 #elif ICE_INT_VERSION >= 30603
162 int c = _ref.fetch_sub(1);
165 if ((
c == numberChilds + 1) && !__hasFlag(NoDelete))
172 bool doDelete =
false;
175 if (--_ref == numberChilds)
177 doDelete = !_noDelete;