TermImpl Class Referenceabstract

TermImpl is the superclass for all implementations of terms in the expression tree, such as LiteralImpl, Operation and ConditionRoot. More...

#include <ArmarXCore/observers/condition/TermImpl.h>

+ Inheritance diagram for TermImpl:

Public Member Functions

void addChild (const TermImplBasePtr &child, const Ice::Current &c=Ice::emptyCurrent) override
 Add child to term.
 
TermImplSequence getChilds (const Ice::Current &c=Ice::emptyCurrent) override
 retrieve childs of this term in the expression tree.
 
StringVariantBaseMap getDatafields (const Ice::Current &) const override
 
TermImplBasePtr getParent (const Ice::Current &c=Ice::emptyCurrent) override
 retrieve parent of this term in the expression tree.
 
TermType getType (const Ice::Current &c=Ice::emptyCurrent) const override
 Retrieve type of term.
 
bool getValue (const Ice::Current &c=Ice::emptyCurrent) const override
 retrieve current value of term.
 
virtual void output (std::ostream &out) const =0
 output to stream.
 
void removeChildren ()
 
void update (const Ice::Current &c=Ice::emptyCurrent) override
 Updates the parent in the expression tree.
 
void updateWithData (const Ice::Current &c=Ice::emptyCurrent) override
 
 ~TermImpl () override
 Destructor of TermImpl.
 

Protected Member Functions

void __decRef () override
 Overwritten version of reference counting from GCShared.
 
void __incRef () override
 Overwritten version of reference counting from GCShared.
 
void resetParent (const Ice::Current &c=Ice::emptyCurrent) override
 Reset the parent of this term.
 
void setParent (const TermImplBasePtr &parent, const Ice::Current &c=Ice::emptyCurrent) override
 Sets the parent for this term in the expression tree.
 

Static Protected Member Functions

static int atomicDecAndTestValue (volatile int *counter, int value)
 atomicDecAndTestValue - decrement and test @v: pointer of type AtomicCounter @value: value to test for
 

Friends

std::ostream & operator<< (std::ostream &stream, const TermImpl *rhs)
 Streaming operator for this class.
 
std::ostream & operator<< (std::ostream &stream, const TermImplPtr &rhs)
 Streaming operator for this class.
 

Detailed Description

TermImpl is the superclass for all implementations of terms in the expression tree, such as LiteralImpl, Operation and ConditionRoot.

The TermImpl is the backend to the API frontend Term. It inherits from Ice::Object in order to allow serialization via Ice and provides all methods to build an expression tree.

Each term has a boolean value. Values are updated from the childs in the expression tree by calling update(). Further, the update method calls the parents state update(). Thus, expression trees consisting of TermImpl are updated from bottom to top.

Constructor & Destructor Documentation

◆ ~TermImpl()

~TermImpl ( )
override

Destructor of TermImpl.

Assures handling of cyclic IceInternal::Handle dependencies

Member Function Documentation

◆ __decRef()

void __decRef ( )
overrideprotected

Overwritten version of reference counting from GCShared.

Resolves cyclic dependencies in the tree without makin use of the garbage collector.

See also
Shared::__decRef()
GCShared::__decRef()

◆ __incRef()

void __incRef ( )
overrideprotected

Overwritten version of reference counting from GCShared.

Reference counter increment without garbage collection. Uses Shared::__incRef instead of GCShared::__incRef()

See also
Shared::__incRef()
GCShared::__incRef()

◆ addChild()

void addChild ( const TermImplBasePtr & child,
const Ice::Current & c = Ice::emptyCurrent )
override

Add child to term.

This is used to generate an expression tree.

Parameters
childshared pointer to child

◆ atomicDecAndTestValue()

int atomicDecAndTestValue ( volatile int * counter,
int value )
inlinestaticprotected

atomicDecAndTestValue - decrement and test @v: pointer of type AtomicCounter @value: value to test for

Atomically decrements @v by 1 and returns true if the result is value, or false for all other cases. Note that the guaranteed useful range of an AtomicCounter is only 24 bits.

Inlined because this operation is performance critical.

◆ getChilds()

TermImplSequence getChilds ( const Ice::Current & c = Ice::emptyCurrent)
override

retrieve childs of this term in the expression tree.

Returns
list of child terms

◆ getDatafields()

StringVariantBaseMap getDatafields ( const Ice::Current & ) const
override

◆ getParent()

TermImplBasePtr getParent ( const Ice::Current & c = Ice::emptyCurrent)
override

retrieve parent of this term in the expression tree.

For the root node this is NULL.

Returns
shared pointer to parent

◆ getType()

TermType getType ( const Ice::Current & c = Ice::emptyCurrent) const
override

Retrieve type of term.

Returns
type of the term

◆ getValue()

bool getValue ( const Ice::Current & c = Ice::emptyCurrent) const
override

retrieve current value of term.

Does not evaluate the child nodes.

Returns
current value of the term

◆ output()

virtual void output ( std::ostream & out) const
pure virtual

output to stream.

pure virtual.

Parameters
stream

Implemented in ConditionRoot, LiteralImpl, OperationAnd, OperationNot, and OperationOr.

◆ removeChildren()

void removeChildren ( )

◆ resetParent()

void resetParent ( const Ice::Current & c = Ice::emptyCurrent)
overrideprotected

Reset the parent of this term.

◆ setParent()

void setParent ( const TermImplBasePtr & parent,
const Ice::Current & c = Ice::emptyCurrent )
overrideprotected

Sets the parent for this term in the expression tree.

Parameters
sharedpointer to parent

◆ update()

void update ( const Ice::Current & c = Ice::emptyCurrent)
override

Updates the parent in the expression tree.

call update after each change to this->value.

◆ updateWithData()

void updateWithData ( const Ice::Current & c = Ice::emptyCurrent)
override

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & stream,
const TermImpl * rhs )
friend

Streaming operator for this class.

Parameters
streamstream to output
rhsright handside

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & stream,
const TermImplPtr & rhs )
friend

Streaming operator for this class.

Parameters
streamstream to output
rhsright handside

The documentation for this class was generated from the following files: