Loading...
Searching...
No Matches
composite.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_COMPOSITE_H
#define BALL_CONCEPT_COMPOSITE_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_CONCEPT_PERSISTENTOBJECT_H
# include <BALL/CONCEPT/persistentObject.h>
#endif
#ifndef BALL_CONCEPT_COMPARATOR_H
# include <BALL/CONCEPT/comparator.h>
#endif
#ifndef BALL_CONCEPT_BIDIRECTIONALITERATOR_H
# include <BALL/CONCEPT/bidirectionalIterator.h>
#endif
#ifndef BALL_CONCEPT_OBJECT_H
# include <BALL/CONCEPT/object.h>
#endif
#ifndef BALL_CONCEPT_SELECTABLE_H
# include <BALL/CONCEPT/selectable.h>
#endif
#ifndef BALL_CONCEPT_VISITOR_H
# include <BALL/CONCEPT/visitor.h>
#endif
#ifndef BALL_CONCEPT_PROCESSOR_H
# include <BALL/CONCEPT/processor.h>
#endif
#ifndef BALL_CONCEPT_TIMESTAMP_H
# include <BALL/CONCEPT/timeStamp.h>
#endif
namespace BALL
{
class Atom;
class BALL_EXPORT Composite
: public PersistentObject,
public Selectable
{
public:
#ifndef BALL_KERNEL_PREDICATE_TYPE
#define BALL_KERNEL_PREDICATE_TYPE
typedef UnaryPredicate<Composite> KernelPredicateType;
#endif
enum StampType
{
MODIFICATION = 1,
SELECTION = 2,
BOTH = 3
};
BALL_CREATE_DEEP(Composite)
static UnaryProcessor<Composite> DEFAULT_PROCESSOR;
static KernelPredicateType DEFAULT_UNARY_PREDICATE;
Composite()
;
Composite(const Composite& composite, bool deep = true)
;
virtual ~Composite()
;
virtual void clear()
;
virtual void destroy()
;
void destroy(bool virtual_destroy)
;
void* clone(Composite& root) const
;
virtual void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
virtual void persistentRead(PersistenceManager& pm);
void set(const Composite& composite, bool deep = true) ;
Composite& operator = (const Composite& composite) ;
void get(Composite& composite, bool deep = true) const ;
Size getDegree() const ;
Size count(const KernelPredicateType& predicate) const ;
Size countDescendants() const ;
Size getPathLength(const Composite& composite) const ;
Size getDepth() const ;
Size getHeight() const
;
Composite& getRoot() ;
const Composite& getRoot() const ;
Composite* getLowestCommonAncestor(const Composite& composite)
;
const Composite* getLowestCommonAncestor(const Composite& composite) const
;
template <typename T>
T* getAncestor(const T& /* dummy */)
;
template <typename T>
const T* getAncestor(const T& /* dummy */) const ;
template <typename T>
T* getPrevious(const T& /* dummy */) ;
template <typename T>
const T* getPrevious(const T& dummy) const ;
template <typename T>
T* getNext(const T& /* dummy */) ;
template <typename T>
const T* getNext(const T& dummy) const ;
Composite* getParent() ;
const Composite* getParent() const ;
Composite* getChild(Index index) ;
const Composite* getChild(Index index) const ;
Composite* getSibling(Index index) ;
const Composite* getSibling(Index index) const ;
Composite* getFirstChild() ;
const Composite* getFirstChild() const ;
Composite* getLastChild() ;
const Composite* getLastChild() const ;
const PreciseTime& getModificationTime() const ;
const PreciseTime& getSelectionTime() const ;
void stamp(StampType stamp = BOTH) ;
void prependChild(Composite& composite) ;
void appendChild(Composite& composite) ;
static bool insertParent(Composite& parent, Composite& first,
Composite& last, bool destroy_parent = true)
;
void insertBefore(Composite& composite) ;
void insertAfter(Composite& composite) ;
void spliceBefore(Composite& composite) ;
void spliceAfter(Composite& composite) ;
void splice(Composite& composite) ;
bool removeChild(Composite& child) ;
Size removeSelected() ;
Size removeUnselected();
void replace(Composite& composite) ;
void swap(Composite& composite) ;
virtual void select() ;
virtual void deselect() ;
bool operator == (const Composite& composite) const ;
bool operator != (const Composite& composite) const
;
bool isEmpty() const ;
bool isRoot() const ;
bool isRootOf(const Composite& composite) const ;
bool isInterior() const ;
bool hasChild() const ;
bool isChildOf(const Composite& composite) const ;
bool isFirstChild() const ;
bool isFirstChildOf(const Composite& composite) const ;
bool isLastChild() const ;
bool isLastChildOf(const Composite& composite) const ;
bool hasParent() const ;
bool isParentOf(const Composite& composite) const ;
bool hasSibling() const ;
bool isSiblingOf(const Composite& composite) const ;
bool hasPreviousSibling() const ;
bool isPreviousSiblingOf(const Composite& composite) const ;
bool hasNextSibling() const ;
bool isNextSiblingOf(const Composite& composite) const ;
bool isDescendantOf(const Composite& composite) const ;
template <typename T>
bool hasAncestor(const T& dummy) const ;
bool isAncestorOf(const Composite& composite) const ;
bool isRelatedWith(const Composite& composite) const ;
bool isHomomorph(const Composite& composite) const ;
bool containsSelection() const ;
virtual bool isAtom() const { return false; }
virtual bool isMolecule() const { return false; }
virtual bool isProtein() const { return false; }
virtual bool isFragment() const { return false; }
virtual bool isResidue() const { return false; }
virtual bool isChain() const { return false; }
virtual bool isValid() const ;
virtual void dump(std::ostream& s = std::cout, Size depth = 0) const
;
void host(Visitor<Composite>& visitor);
template <typename T>
bool applyAncestor(UnaryProcessor<T>& processor);
template <typename T>
bool applyAncestor(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyChild(UnaryProcessor<T>& processor);
template <typename T>
bool applyChild(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyDescendantPreorder(UnaryProcessor<T>& processor);
template <typename T>
bool applyDescendantPreorder(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyDescendantPostorder(UnaryProcessor<T>& processor);
template <typename T>
bool applyDescendantPostorder(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyDescendant(UnaryProcessor<T>& processor);
template <typename T>
bool applyDescendant(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyPreorder(UnaryProcessor<T>& processor);
template <typename T>
bool applyPreorder(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyPostorder(UnaryProcessor<T>& processor);
template <typename T>
bool applyPostorder(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool apply(UnaryProcessor<T>& processor);
template <typename T>
bool apply(ConstUnaryProcessor<T>& processor) const;
template <typename T>
bool applyLevel(UnaryProcessor<T>& processor, long level);
template <typename T>
bool applyLevel(ConstUnaryProcessor<T>& processor, long level) const;
class BALL_EXPORT AncestorIteratorTraits
{
public:
BALL_INLINE
AncestorIteratorTraits()
: bound_(0),
ancestor_(0)
{
}
BALL_INLINE
AncestorIteratorTraits(const Composite& composite)
: bound_(const_cast<Composite*>(&composite)),
ancestor_(0)
{
}
BALL_INLINE
AncestorIteratorTraits(const AncestorIteratorTraits& traits)
: bound_(traits.bound_),
ancestor_(traits.ancestor_)
{
}
BALL_INLINE
const AncestorIteratorTraits& operator = (const AncestorIteratorTraits& traits)
{
bound_ = traits.bound_;
ancestor_ = traits.ancestor_;
return *this;
}
BALL_INLINE Composite* getContainer() { return bound_; }
BALL_INLINE const Composite* getContainer() const { return bound_; }
BALL_INLINE bool isSingular() const { return (bound_ == 0); }
BALL_INLINE Composite* getPosition() { return ancestor_; }
BALL_INLINE Composite* const& getPosition() const { return ancestor_; }
BALL_INLINE bool operator == (const AncestorIteratorTraits& traits) const { return (ancestor_ == traits.ancestor_); }
BALL_INLINE bool operator != (const AncestorIteratorTraits& traits) const { return !(ancestor_ == traits.ancestor_); }
BALL_INLINE bool isValid() const { return (bound_ != 0 && ancestor_ != 0); }
BALL_INLINE void invalidate() { bound_ = ancestor_ = 0; }
BALL_INLINE void toBegin() { ancestor_ = bound_->parent_; }
BALL_INLINE bool isBegin() const { return (ancestor_ == bound_->parent_); }
BALL_INLINE void toEnd() { ancestor_ = 0; }
BALL_INLINE bool isEnd() const { return (ancestor_ == 0); }
BALL_INLINE Composite& getData() { return *ancestor_; }
BALL_INLINE const Composite& getData() const { return *ancestor_; }
BALL_INLINE void forward() { ancestor_ = ancestor_->parent_; }
private:
Composite* bound_;
Composite* ancestor_;
};
friend class AncestorIteratorTraits;
typedef ForwardIterator <Composite, Composite, Composite*, AncestorIteratorTraits>
AncestorIterator;
AncestorIterator beginAncestor()
{
return AncestorIterator::begin(*this);
}
AncestorIterator endAncestor()
{
return AncestorIterator::end(*this);
}
typedef ConstForwardIterator<Composite, Composite, Composite*, AncestorIteratorTraits>
AncestorConstIterator;
AncestorConstIterator beginAncestor() const
{
return AncestorConstIterator::begin(*this);
}
AncestorConstIterator endAncestor() const
{
return AncestorConstIterator::end(*this);
}
class BALL_EXPORT ChildCompositeIteratorTraits
{
public:
ChildCompositeIteratorTraits()
: bound_(0),
child_(0)
{
}
ChildCompositeIteratorTraits(const Composite& composite)
: bound_((Composite *)&composite),
child_(0)
{
}
ChildCompositeIteratorTraits(const ChildCompositeIteratorTraits& traits)
: bound_(traits.bound_),
child_(traits.child_)
{
}
const ChildCompositeIteratorTraits& operator = (const ChildCompositeIteratorTraits& traits)
{
bound_ = traits.bound_;
child_ = traits.child_;
return *this;
}
BALL_INLINE Composite* getContainer() { return bound_; }
BALL_INLINE const Composite* getContainer() const { return bound_; }
BALL_INLINE bool isSingular() const { return (bound_ == 0); }
BALL_INLINE Composite* getPosition() { return child_; }
BALL_INLINE Composite* const& getPosition() const { return child_; }
BALL_INLINE bool operator == (const ChildCompositeIteratorTraits& traits) const { return (child_ == traits.child_); }
BALL_INLINE bool operator != (const ChildCompositeIteratorTraits& traits) const { return !(child_ == traits.child_); }
BALL_INLINE bool isValid() const { return (bound_ != 0 && child_ != 0); }
BALL_INLINE void invalidate() { bound_ = child_ = 0; }
BALL_INLINE void toBegin() { child_ = bound_->first_child_; }
BALL_INLINE bool isBegin() const { return (child_ == bound_->first_child_); }
BALL_INLINE void toEnd() { child_ = 0; }
BALL_INLINE bool isEnd() const { return (child_ == 0); }
BALL_INLINE void toRBegin() { child_ = bound_->last_child_; }
BALL_INLINE bool isRBegin() const { return (child_ == bound_->last_child_); }
BALL_INLINE void toREnd() { child_ = 0; }
BALL_INLINE bool isREnd() const { return (child_ == 0); }
BALL_INLINE Composite& getData() { return *child_; }
BALL_INLINE const Composite& getData() const { return *child_; }
BALL_INLINE void forward() { child_ = child_->next_; }
BALL_INLINE void backward()
{
if (child_ == 0)
{
// Allow decrementation for past-the-end iterators
child_ = bound_->last_child_;
}
else
{
child_ = child_->previous_;
}
}
private:
Composite* bound_;
Composite* child_;
};
friend class ChildCompositeIteratorTraits;
typedef BidirectionalIterator<Composite, Composite, Composite *, ChildCompositeIteratorTraits>
ChildCompositeIterator;
ChildCompositeIterator beginChildComposite()
{
return ChildCompositeIterator::begin(*this);
}
ChildCompositeIterator endChildComposite()
{
return ChildCompositeIterator::end(*this);
}
typedef ConstBidirectionalIterator<Composite, Composite, Composite *, ChildCompositeIteratorTraits>
ChildCompositeConstIterator;
ChildCompositeConstIterator beginChildComposite() const
{
return ChildCompositeConstIterator::begin(*this);
}
ChildCompositeConstIterator endChildComposite() const
{
return ChildCompositeConstIterator::end(*this);
}
typedef std::reverse_iterator<ChildCompositeIterator> ChildCompositeReverseIterator;
ChildCompositeReverseIterator rbeginChildComposite()
{
return ChildCompositeReverseIterator(endChildComposite());
}
ChildCompositeReverseIterator rendChildComposite()
{
return ChildCompositeReverseIterator(beginChildComposite());
}
typedef std::reverse_iterator<ChildCompositeConstIterator> ChildCompositeConstReverseIterator;
ChildCompositeConstReverseIterator rbeginChildComposite() const
{
return ChildCompositeConstReverseIterator(endChildComposite());
}
ChildCompositeConstReverseIterator rendChildComposite() const
{
return ChildCompositeConstReverseIterator(beginChildComposite());
}
class BALL_EXPORT CompositeIteratorTraits
{
public:
BALL_INLINE CompositeIteratorTraits()
: bound_(0),
position_(0)
{
}
CompositeIteratorTraits(const Composite& composite)
: bound_(const_cast<Composite*>(&composite)),
position_(0)
{
}
CompositeIteratorTraits(const CompositeIteratorTraits& traits)
: bound_(traits.bound_),
position_(traits.position_)
{
}
BALL_INLINE ~CompositeIteratorTraits() {}
BALL_INLINE bool isValid() const
{
return ((bound_ != 0) && (position_ != 0));
}
BALL_INLINE CompositeIteratorTraits& operator = (const CompositeIteratorTraits& traits)
{
bound_ = traits.bound_;
position_ = traits.position_;
return *this;
}
BALL_INLINE Composite* getContainer() { return bound_; }
BALL_INLINE const Composite* getContainer() const { return bound_; }
BALL_INLINE bool isSingular() const { return (bound_ == 0); }
BALL_INLINE Composite* getPosition() { return position_; }
BALL_INLINE const Composite* getPosition() const { return position_; }
BALL_INLINE void setPosition(Composite* position) { position_ = position; }
BALL_INLINE Composite& getData() { return *position_; }
BALL_INLINE const Composite& getData() const { return *position_; }
BALL_INLINE bool operator == (const CompositeIteratorTraits& traits) const
{
return (position_ == traits.position_);
}
BALL_INLINE bool operator != (const CompositeIteratorTraits& traits) const
{
return !(position_ == traits.position_);
}
BALL_INLINE void invalidate()
{
bound_ = 0;
position_ = 0;
}
BALL_INLINE void toBegin()
{
position_ = bound_;
}
BALL_INLINE bool isBegin() const
{
return (position_ == bound_);
}
BALL_INLINE void toEnd()
{
position_ = 0;
}
BALL_INLINE bool isEnd() const
{
return (position_ == 0);
}
BALL_INLINE void toRBegin()
{
if (bound_ != 0)
{
position_ = findPreviousPosition(0);
}
}
BALL_INLINE bool isRBegin() const
{
return (position_ == findPreviousPosition(0));
}
BALL_INLINE void toREnd()
{
position_ = bound_;
}
BALL_INLINE bool isREnd() const
{
return (position_ == bound_);
}
BALL_INLINE void forward()
{
position_ = findNextPosition(position_);
}
BALL_INLINE void backward()
{
position_ = findPreviousPosition(position_);
}
protected:
Composite* bound_;
Composite* position_;
Composite* findPreviousPosition(Composite* p) const
{
// If we are at the root of the iterator, the
// decrementing it results in an invalid iterator
// (past-the-end).
if (p == bound_)
{
return 0;
}
// If we decrement a past-the-end-iterator, we
// start at the root and "fall down" on the right
// hand side following the last_child_ pointers
// until we hit bottom.
else if (p == 0)
{
if (bound_->last_child_ == 0)
{
return bound_;
}
else
{
p = bound_->last_child_;
}
while (p->last_child_ != 0)
{
p = p->last_child_;
}
}
// Normally, we just grab the guy to the
// left in the doubly-linked child list.
else if (p->previous_ != 0)
{
p = p->previous_;
// If the guy to the left hast children,
// we do the drop on the rigth again.
while (p->last_child_ != 0)
{
p = p->last_child_;
}
}
// Finally, if we can't go down and we can't go
// left, we have to go upwards.
else if (p != bound_)
{
p = p->parent_;
}
return p;
}
Composite* findNextPosition(Composite* p) const
{
// If we are in a past-the-end position, we stay put.
if (p == 0)
{
return 0;
}
// Otherwise, we try the first child. If there's one,
// that's our next position.
else
{
if (p->first_child_ != 0)
{
p = p->first_child_;
}
else
{
// If we are already in the root node, we are done.
if (p == bound_)
{
return 0;
}
// Otherwise, we try to walk to the right at the current level.
if (p->next_ != 0)
{
p = p->next_;
}
// If that doesn't work out, we'll have to climb up again.
// Now, we either revisit a node we have already been to, or we
// are trying to climb up *beyond* our iteration root (bound_).
// In the latter case, we return a past-the-end-iterator (0).
else
{
// If we could not walk left or right and we are at the root
// again, then we are done with the iteration (this is the
// case if bound_ is a leaf node).
while (p->next_ == 0)
{
p = p->parent_;
if ((p == bound_) || (p == 0))
{
return 0;
}
}
p = p->next_;
}
}
}
return p;
}
};
friend class CompositeIteratorTraits;
typedef BidirectionalIterator<Composite, Composite, Composite*, CompositeIteratorTraits>
CompositeIterator;
CompositeIterator beginComposite() { return CompositeIterator::begin(*this); }
CompositeIterator endComposite() { return CompositeIterator::end(*this); }
typedef ConstBidirectionalIterator<Composite, Composite, Composite*, CompositeIteratorTraits>
CompositeConstIterator;
CompositeConstIterator beginComposite() const
{
return CompositeConstIterator::begin(*this);
}
CompositeConstIterator endComposite() const
{
return CompositeConstIterator::end(*this);
}
typedef std::reverse_iterator<CompositeIterator> CompositeReverseIterator;
CompositeReverseIterator rbeginComposite()
{
return CompositeReverseIterator(endComposite());
}
CompositeReverseIterator rendComposite()
{
return CompositeReverseIterator(beginComposite());
}
typedef std::reverse_iterator<CompositeConstIterator> CompositeConstReverseIterator;
CompositeConstReverseIterator rbeginComposite() const
{
return CompositeConstReverseIterator(endComposite());
}
CompositeConstReverseIterator rendComposite() const
{
return CompositeConstReverseIterator(beginComposite());
}
/*
* This function removes and deletes all composites that are
* supplied in the list of children.
*/
void deleteChildrenList_(std::list<Composite*>& composites);
private:
Size getHeight_(Size size, Size& max_height) const ;
Size countDescendants_() const ;
void clone_(Composite& parent, Composite& stack) const ;
// \throws Exception::GeneralException
template <typename T>
bool applyLevelNostart_(UnaryProcessor<T>& processor, long level);
// \throws Exception::GeneralException
template <typename T>
bool applyLevelNostart_(ConstUnaryProcessor<T>& processor, long level) const;
// \throws Exception::GeneralException
template <typename T>
bool applyChildNostart_(UnaryProcessor<T>& processor);
// \throws Exception::GeneralException
template <typename T>
bool applyChildNostart_(ConstUnaryProcessor<T>& processor) const;
// \throws Exception::GeneralException
template <typename T>
bool applyPreorderNostart_(UnaryProcessor<T>& processor);
// \throws Exception::GeneralException
bool applyPreorderNostart_(UnaryProcessor<Atom>& processor);
// \throws Exception::GeneralException
template <typename T>
bool applyPreorderNostart_(ConstUnaryProcessor<T>& processor) const;
// \throws Exception::GeneralException
template <typename T>
bool applyDescendantPreorderNostart_(UnaryProcessor<T>& processor);
// \throws Exception::GeneralException
bool applyDescendantPreorderNostart_(UnaryProcessor<Atom>& processor);
// \throws Exception::GeneralException
template <typename T>
bool applyDescendantPreorderNostart_(ConstUnaryProcessor<T>& processor) const;
// \throws Exception::GeneralException
template <typename T>
bool applyDescendantPostorderNostart_(UnaryProcessor<T>& processor);
// \throws Exception::GeneralException
template <typename T>
bool applyDescendantPostorderNostart_(ConstUnaryProcessor<T>& processor) const;
void updateSelection_();
void determineSelection_();
void select_(bool update_parent = true);
void deselect_(bool update_parent = true);
void destroyChildren_();
// private attributes
Size number_of_children_;
Composite* parent_;
Composite* previous_;
Composite* next_;
Composite* first_child_;
Composite* last_child_;
unsigned char properties_;
bool contains_selection_;
Size number_of_selected_children_;
Size number_of_children_containing_selection_;
TimeStamp selection_stamp_;
TimeStamp modification_stamp_;
};
template <typename T>
bool Composite::applyAncestor(UnaryProcessor<T>& processor)
{
if (processor.start() == false)
{
return false;
}
Processor::Result result;
for (Composite* composite = parent_; composite != 0; composite = composite->parent_)
{
T* t_ptr;
if ((t_ptr = dynamic_cast<T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
return processor.finish();
}
template <typename T>
bool Composite::applyAncestor(ConstUnaryProcessor<T>& processor) const
{
if (processor.start() == false)
{
return false;
}
Processor::Result result;
for (const Composite* composite = parent_; composite != 0; composite = composite->parent_)
{
const T* t_ptr;
if ((t_ptr = dynamic_cast<const T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
return processor.finish();
}
template <typename T>
bool Composite::applyChild(UnaryProcessor<T>& processor)
{
return processor.start() && applyChildNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyChild(ConstUnaryProcessor<T>& processor) const
{
return processor.start() && applyChildNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyChildNostart_(UnaryProcessor<T>& processor)
{
Processor::Result result = Processor::CONTINUE;
for (Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
T* t_ptr;
if ((t_ptr = dynamic_cast<T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
break;
}
}
}
return (result >= Processor::BREAK);
}
template <typename T>
bool Composite::applyChildNostart_(ConstUnaryProcessor<T>& processor) const
{
Processor::Result result = Processor::CONTINUE;
for (const Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
const T* t_ptr;
if ((t_ptr = dynamic_cast<const T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
break;
}
}
}
return (result >= Processor::BREAK);
}
template <typename T>
bool Composite::applyDescendantPreorder(UnaryProcessor<T>& processor)
{
return processor.start() && applyDescendantPreorderNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyDescendantPreorder(ConstUnaryProcessor<T>& processor) const
{
return processor.start() && applyDescendantPreorderNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyDescendantPreorderNostart_(UnaryProcessor<T>& processor)
{
Processor::Result result;
for (Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
T* t_ptr;
if ((t_ptr = dynamic_cast<T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
if (composite->first_child_ != 0 && composite->applyDescendantPreorderNostart_(processor) == false)
{
return false;
}
}
return true;
}
template <typename T>
bool Composite::applyDescendantPreorderNostart_(ConstUnaryProcessor<T>& processor) const
{
Processor::Result result;
for (const Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
const T* t_ptr;
if ((t_ptr = dynamic_cast<const T*>(composite)) != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
if (composite->first_child_ != 0 && composite->applyDescendantPreorderNostart_(processor) == false)
{
return false;
}
}
return true;
}
template <typename T>
bool Composite::applyDescendantPostorder(UnaryProcessor<T>& processor)
{
return processor.start() && applyDescendantPostorderNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyDescendantPostorder(ConstUnaryProcessor<T>& processor) const
{
return processor.start() && applyDescendantPostorderNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyDescendantPostorderNostart_(UnaryProcessor<T>& processor)
{
Processor::Result result;
for (Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
if (composite->first_child_ != 0 &&
composite->applyDescendantPostorderNostart_(processor) == false)
{
return false;
}
T* t_ptr = dynamic_cast<T*>(composite);
if (t_ptr != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
return true;
}
template <typename T>
bool Composite::applyDescendantPostorderNostart_(ConstUnaryProcessor<T>& processor) const
{
Processor::Result result;
for (const Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
if (composite->first_child_ != 0 &&
composite->applyDescendantPostorderNostart_(processor) == false)
{
return false;
}
const T* t_ptr = dynamic_cast<const T*>(composite);
if (t_ptr != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
return true;
}
template <typename T>
bool Composite::applyPostorder(UnaryProcessor<T>& processor)
{
if (!processor.start() || !applyDescendantPostorderNostart_(processor))
{
return false;
}
T* t_ptr = dynamic_cast<T*>(this);
return (t_ptr != 0 &&
processor(*t_ptr) >= Processor::BREAK &&
processor.finish() );
}
template <typename T>
bool Composite::applyPostorder(ConstUnaryProcessor<T>& processor) const
{
if (!processor.start() || !applyDescendantPostorderNostart_(processor))
{
return false;
}
const T* t_ptr = dynamic_cast<const T*>(this);
return (t_ptr != 0 &&
processor(*t_ptr) >= Processor::BREAK &&
processor.finish() );
}
template <typename T>
bool Composite::applyLevel(UnaryProcessor<T>& processor, long level)
{
return processor.start() && applyLevelNostart_(processor, level) && processor.finish();
}
template <typename T>
bool Composite::applyLevel(ConstUnaryProcessor<T>& processor, long level) const
{
return processor.start() && applyLevelNostart_(processor, level) && processor.finish();
}
template <typename T>
bool Composite::applyLevelNostart_(UnaryProcessor<T>& processor, long level)
{
if (level == 0)
{
T* t_ptr = dynamic_cast<T*>(this);
if (t_ptr != 0)
{
Processor::Result result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
else
{
if (--level == 0)
{
return applyChildNostart_(processor);
}
else
{
if (level > 0)
{
for (Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
if (composite->first_child_ != 0 && composite->applyLevelNostart_(processor, level) == false)
{
return false;
}
}
}
}
}
return true;
}
template <typename T>
bool Composite::applyLevelNostart_(ConstUnaryProcessor<T>& processor, long level) const
{
if (level == 0)
{
const T* t_ptr = dynamic_cast<const T*>(this);
if (t_ptr != 0)
{
Processor::Result result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return (result == Processor::BREAK);
}
}
}
else
{
if (--level == 0)
{
return applyChildNostart_(processor);
}
else
{
if (level > 0)
{
for (const Composite* composite = first_child_;
composite != 0; composite = composite->next_)
{
if (composite->first_child_ != 0 && composite->applyLevelNostart_(processor, level) == false)
{
return false;
}
}
}
}
}
return true;
}
template <typename T>
bool Composite::applyPreorderNostart_(UnaryProcessor<T>& processor)
{
Processor::Result result;
bool return_value;
T* t_ptr = dynamic_cast<T*>(this);
if (t_ptr != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return_value = (result == Processor::BREAK);
}
else
{
return_value = applyDescendantPreorderNostart_(processor);
}
}
else
{
return_value = applyDescendantPreorderNostart_(processor);
}
return return_value;
}
template <typename T>
bool Composite::applyPreorderNostart_(ConstUnaryProcessor<T>& processor) const
{
Processor::Result result;
bool return_value;
const T* t_ptr = dynamic_cast<const T*>(this);
if (t_ptr != 0)
{
result = processor(*t_ptr);
if (result <= Processor::BREAK)
{
return_value = (result == Processor::BREAK);
}
else
{
return_value = applyDescendantPreorderNostart_(processor);
}
}
else
{
return_value = applyDescendantPreorderNostart_(processor);
}
return return_value;
}
template <typename T>
bool Composite::applyDescendant(UnaryProcessor<T>& processor)
{
return applyDescendantPreorder(processor);
}
template <typename T>
bool Composite::applyDescendant(ConstUnaryProcessor<T>& processor) const
{
return applyDescendantPreorder(processor);
}
template <typename T>
bool Composite::applyPreorder(UnaryProcessor<T>& processor)
{
return processor.start() && applyPreorderNostart_(processor) && processor.finish();
}
template <typename T>
bool Composite::applyPreorder(ConstUnaryProcessor<T>& processor) const
{
return processor.start() && applyPreorderNostart_(processor) && processor.finish();
}
template <typename T>
BALL_INLINE
bool Composite::apply(UnaryProcessor<T>& processor)
{
return applyPreorder(processor);
}
template <typename T>
BALL_INLINE
bool Composite::apply(ConstUnaryProcessor<T>& processor) const
{
return applyPreorder(processor);
}
template <typename T>
BALL_INLINE
T* Composite::getAncestor(const T& /* dummy */)
{
T* T_ptr = 0;
for (Composite* composite_ptr = parent_;
composite_ptr != 0; composite_ptr = composite_ptr->parent_)
{
T_ptr = dynamic_cast<T*>(composite_ptr);
if (T_ptr != 0)
{
break;
}
}
return T_ptr;
}
template <typename T>
BALL_INLINE
const T* Composite::getAncestor(const T& /* dummy */) const
{
T* t_ptr = 0;
for (Composite* composite_ptr = parent_;
composite_ptr != 0; composite_ptr = composite_ptr->parent_)
{
if ((t_ptr = dynamic_cast<T*>(composite_ptr)) != 0)
{
break;
}
}
return const_cast<const T*>(t_ptr);
}
template <typename T>
BALL_INLINE
T* Composite::getPrevious(const T& /* dummy */)
{
// create an iterator bound to the root of the subtree
CompositeIterator it(getRoot().endComposite());
// set its position to the current composite
it.getTraits().setPosition(this);
// walk back until we find something
// or we cannot walk any further
if (+it)
{
do
{
--it;
}
while (+it && !RTTI::isKindOf<T>(&*it));
}
// return a NULL pointer if nothing was found
Composite* ptr = 0;
if (+it)
{
ptr = &*it;
}
return dynamic_cast<T*>(ptr);
}
template <typename T>
BALL_INLINE
const T* Composite::getPrevious(const T& dummy) const
{
// cast away the constness of this and call the non-const method
Composite* nonconst_this = const_cast<Composite*>(this);
return const_cast<const T*>(nonconst_this->getPrevious(dummy));
}
template <typename T>
BALL_INLINE
T* Composite::getNext(const T& /* dummy */)
{
// create an iterator bound to the root of the subtree
CompositeIterator it(getRoot().beginComposite());
// set its position to the current composite
it.getTraits().setPosition(this);
// walk forward until we find something
// or we cannot walk any further
do
{
it++;
}
while (it.isValid() && !RTTI::isKindOf<T>(&*it));
// return a NULL pointer if nothing was found
Composite* ptr = 0;
if (+it)
{
ptr = &*it;
}
return dynamic_cast<T*>(ptr);
}
template <typename T>
BALL_INLINE
const T* Composite::getNext(const T& dummy) const
{
// cast away the constness of this and call the non-const method
Composite* nonconst_this = const_cast<Composite*>(this);
return const_cast<const T*>(nonconst_this->getNext(dummy));
}
template <typename T>
BALL_INLINE
bool Composite::hasAncestor(const T& dummy ) const
{
return (getAncestor(dummy) != 0);
}
# ifndef BALL_NO_INLINE_FUNCTIONS
# include <BALL/CONCEPT/composite.iC>
# endif
} // namespace BALL
#endif // BALL_CONCEPT_COMPOSITE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
bidirectionalIterator.h
BALL::Atom
Definition atom.h:90
BALL::BaseIterator::getTraits
BALL_INLINE const Traits & getTraits() const
Get a constant reference to the traits of this iterator.
Definition baseIterator.h:130
BALL::BaseIterator::isValid
BALL_INLINE bool isValid() const
Definition baseIterator.h:175
BALL::BidirectionalIterator
Mutable bidirectional iterator.
Definition bidirectionalIterator.h:260
BALL::BidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits >::end
static BidirectionalIterator end(const Composite &container)
BALL::BidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits >::begin
static BidirectionalIterator begin(const Composite &container)
BALL::Composite::AncestorIteratorTraits
Definition composite.h:974
BALL::Composite::AncestorIteratorTraits::AncestorIteratorTraits
BALL_INLINE AncestorIteratorTraits()
Definition composite.h:978
BALL::Composite::AncestorIteratorTraits::invalidate
BALL_INLINE void invalidate()
Definition composite.h:1026
BALL::Composite::AncestorIteratorTraits::isEnd
BALL_INLINE bool isEnd() const
Definition composite.h:1034
BALL::Composite::AncestorIteratorTraits::isValid
BALL_INLINE bool isValid() const
Definition composite.h:1024
BALL::Composite::AncestorIteratorTraits::toBegin
BALL_INLINE void toBegin()
Definition composite.h:1028
BALL::Composite::AncestorIteratorTraits::getData
BALL_INLINE Composite & getData()
Definition composite.h:1036
BALL::Composite::AncestorIteratorTraits::forward
BALL_INLINE void forward()
Definition composite.h:1040
BALL::Composite::AncestorIteratorTraits::AncestorIteratorTraits
BALL_INLINE AncestorIteratorTraits(const Composite &composite)
Definition composite.h:986
BALL::Composite::AncestorIteratorTraits::isSingular
BALL_INLINE bool isSingular() const
Definition composite.h:1014
BALL::Composite::AncestorIteratorTraits::getContainer
BALL_INLINE Composite * getContainer()
Definition composite.h:1010
BALL::Composite::AncestorIteratorTraits::getPosition
BALL_INLINE Composite *const & getPosition() const
Definition composite.h:1018
BALL::Composite::AncestorIteratorTraits::AncestorIteratorTraits
BALL_INLINE AncestorIteratorTraits(const AncestorIteratorTraits &traits)
Definition composite.h:994
BALL::Composite::AncestorIteratorTraits::toEnd
BALL_INLINE void toEnd()
Definition composite.h:1032
BALL::Composite::AncestorIteratorTraits::getContainer
BALL_INLINE const Composite * getContainer() const
Definition composite.h:1012
BALL::Composite::AncestorIteratorTraits::isBegin
BALL_INLINE bool isBegin() const
Definition composite.h:1030
BALL::Composite::AncestorIteratorTraits::getData
BALL_INLINE const Composite & getData() const
Definition composite.h:1038
BALL::Composite::AncestorIteratorTraits::getPosition
BALL_INLINE Composite * getPosition()
Definition composite.h:1016
BALL::Composite::ChildCompositeIteratorTraits
Definition composite.h:1077
BALL::Composite::ChildCompositeIteratorTraits::isSingular
BALL_INLINE bool isSingular() const
Definition composite.h:1113
BALL::Composite::ChildCompositeIteratorTraits::getContainer
BALL_INLINE Composite * getContainer()
Definition composite.h:1109
BALL::Composite::ChildCompositeIteratorTraits::getData
BALL_INLINE const Composite & getData() const
Definition composite.h:1145
BALL::Composite::ChildCompositeIteratorTraits::ChildCompositeIteratorTraits
ChildCompositeIteratorTraits(const ChildCompositeIteratorTraits &traits)
Definition composite.h:1094
BALL::Composite::ChildCompositeIteratorTraits::isREnd
BALL_INLINE bool isREnd() const
Definition composite.h:1141
BALL::Composite::ChildCompositeIteratorTraits::getPosition
BALL_INLINE Composite * getPosition()
Definition composite.h:1115
BALL::Composite::ChildCompositeIteratorTraits::forward
BALL_INLINE void forward()
Definition composite.h:1147
BALL::Composite::ChildCompositeIteratorTraits::isEnd
BALL_INLINE bool isEnd() const
Definition composite.h:1133
BALL::Composite::ChildCompositeIteratorTraits::getPosition
BALL_INLINE Composite *const & getPosition() const
Definition composite.h:1117
BALL::Composite::ChildCompositeIteratorTraits::toRBegin
BALL_INLINE void toRBegin()
Definition composite.h:1135
BALL::Composite::ChildCompositeIteratorTraits::ChildCompositeIteratorTraits
ChildCompositeIteratorTraits(const Composite &composite)
Definition composite.h:1087
BALL::Composite::ChildCompositeIteratorTraits::getData
BALL_INLINE Composite & getData()
Definition composite.h:1143
BALL::Composite::ChildCompositeIteratorTraits::getContainer
BALL_INLINE const Composite * getContainer() const
Definition composite.h:1111
BALL::Composite::ChildCompositeIteratorTraits::toREnd
BALL_INLINE void toREnd()
Definition composite.h:1139
BALL::Composite::ChildCompositeIteratorTraits::toEnd
BALL_INLINE void toEnd()
Definition composite.h:1131
BALL::Composite::ChildCompositeIteratorTraits::toBegin
BALL_INLINE void toBegin()
Definition composite.h:1127
BALL::Composite::ChildCompositeIteratorTraits::isValid
BALL_INLINE bool isValid() const
Definition composite.h:1123
BALL::Composite::ChildCompositeIteratorTraits::isBegin
BALL_INLINE bool isBegin() const
Definition composite.h:1129
BALL::Composite::ChildCompositeIteratorTraits::isRBegin
BALL_INLINE bool isRBegin() const
Definition composite.h:1137
BALL::Composite::ChildCompositeIteratorTraits::backward
BALL_INLINE void backward()
Definition composite.h:1149
BALL::Composite::ChildCompositeIteratorTraits::invalidate
BALL_INLINE void invalidate()
Definition composite.h:1125
BALL::Composite::ChildCompositeIteratorTraits::ChildCompositeIteratorTraits
ChildCompositeIteratorTraits()
Definition composite.h:1080
BALL::Composite::CompositeIteratorTraits
Definition composite.h:1231
BALL::Composite::CompositeIteratorTraits::isREnd
BALL_INLINE bool isREnd() const
Definition composite.h:1339
BALL::Composite::CompositeIteratorTraits::getContainer
BALL_INLINE Composite * getContainer()
Definition composite.h:1269
BALL::Composite::CompositeIteratorTraits::toRBegin
BALL_INLINE void toRBegin()
Definition composite.h:1321
BALL::Composite::CompositeIteratorTraits::toREnd
BALL_INLINE void toREnd()
Definition composite.h:1334
BALL::Composite::CompositeIteratorTraits::invalidate
BALL_INLINE void invalidate()
Definition composite.h:1295
BALL::Composite::CompositeIteratorTraits::getData
BALL_INLINE const Composite & getData() const
Definition composite.h:1283
BALL::Composite::CompositeIteratorTraits::getPosition
BALL_INLINE Composite * getPosition()
Definition composite.h:1275
BALL::Composite::CompositeIteratorTraits::CompositeIteratorTraits
CompositeIteratorTraits(const CompositeIteratorTraits &traits)
Definition composite.h:1248
BALL::Composite::CompositeIteratorTraits::findNextPosition
Composite * findNextPosition(Composite *p) const
Definition composite.h:1413
BALL::Composite::CompositeIteratorTraits::getData
BALL_INLINE Composite & getData()
Definition composite.h:1281
BALL::Composite::CompositeIteratorTraits::position_
Composite * position_
The current iterator position.
Definition composite.h:1360
BALL::Composite::CompositeIteratorTraits::isSingular
BALL_INLINE bool isSingular() const
Definition composite.h:1273
BALL::Composite::CompositeIteratorTraits::toEnd
BALL_INLINE void toEnd()
Definition composite.h:1311
BALL::Composite::CompositeIteratorTraits::~CompositeIteratorTraits
BALL_INLINE ~CompositeIteratorTraits()
Definition composite.h:1255
BALL::Composite::CompositeIteratorTraits::forward
BALL_INLINE void forward()
Definition composite.h:1344
BALL::Composite::CompositeIteratorTraits::CompositeIteratorTraits
BALL_INLINE CompositeIteratorTraits()
Definition composite.h:1234
BALL::Composite::CompositeIteratorTraits::toBegin
BALL_INLINE void toBegin()
Definition composite.h:1301
BALL::Composite::CompositeIteratorTraits::isBegin
BALL_INLINE bool isBegin() const
Definition composite.h:1306
BALL::Composite::CompositeIteratorTraits::findPreviousPosition
Composite * findPreviousPosition(Composite *p) const
Definition composite.h:1362
BALL::Composite::CompositeIteratorTraits::CompositeIteratorTraits
CompositeIteratorTraits(const Composite &composite)
Definition composite.h:1241
BALL::Composite::CompositeIteratorTraits::isRBegin
BALL_INLINE bool isRBegin() const
Definition composite.h:1329
BALL::Composite::CompositeIteratorTraits::isEnd
BALL_INLINE bool isEnd() const
Definition composite.h:1316
BALL::Composite::CompositeIteratorTraits::isValid
BALL_INLINE bool isValid() const
Definition composite.h:1257
BALL::Composite::CompositeIteratorTraits::getContainer
BALL_INLINE const Composite * getContainer() const
Definition composite.h:1271
BALL::Composite::CompositeIteratorTraits::getPosition
BALL_INLINE const Composite * getPosition() const
Definition composite.h:1277
BALL::Composite::CompositeIteratorTraits::setPosition
BALL_INLINE void setPosition(Composite *position)
Definition composite.h:1278
BALL::Composite::CompositeIteratorTraits::backward
BALL_INLINE void backward()
Definition composite.h:1349
BALL::Composite::CompositeIteratorTraits::bound_
Composite * bound_
A pointer to the "container" the iterator is bound to.
Definition composite.h:1357
BALL::Composite
Definition composite.h:74
BALL::Composite::CompositeReverseIterator
std::reverse_iterator< CompositeIterator > CompositeReverseIterator
Definition composite.h:1488
BALL::Composite::countDescendants
Size countDescendants() const
BALL::Composite::replace
void replace(Composite &composite)
BALL::Composite::applyLevel
bool applyLevel(UnaryProcessor< T > &processor, long level)
Definition composite.h:1877
BALL::Composite::getDegree
Size getDegree() const
BALL::Composite::isNextSiblingOf
bool isNextSiblingOf(const Composite &composite) const
BALL::Composite::applyDescendantPostorder
bool applyDescendantPostorder(UnaryProcessor< T > &processor)
Definition composite.h:1776
BALL::Composite::getRoot
Composite & getRoot()
BALL::Composite::getNext
T * getNext(const T &)
BALL::Composite::persistentWrite
virtual void persistentWrite(PersistenceManager &pm, const char *name=0) const
BALL::Composite::rendComposite
CompositeReverseIterator rendComposite()
Definition composite.h:1495
BALL::Composite::applyAncestor
bool applyAncestor(UnaryProcessor< T > &processor)
Definition composite.h:1600
BALL::Composite::beginChildComposite
ChildCompositeConstIterator beginChildComposite() const
Definition composite.h:1190
BALL::Composite::Composite
Composite()
BALL::Composite::getPrevious
T * getPrevious(const T &)
BALL::Composite::hasChild
bool hasChild() const
BALL::Composite::endAncestor
AncestorConstIterator endAncestor() const
Definition composite.h:1071
BALL::Composite::getChild
Composite * getChild(Index index)
BALL::Composite::KernelPredicateType
UnaryPredicate< Composite > KernelPredicateType
Definition composite.h:88
BALL::Composite::hasAncestor
bool hasAncestor(const T &dummy) const
BALL::Composite::isAncestorOf
bool isAncestorOf(const Composite &composite) const
BALL::Composite::getSibling
Composite * getSibling(Index index)
BALL::Composite::rbeginChildComposite
ChildCompositeConstReverseIterator rbeginChildComposite() const
Definition composite.h:1220
BALL::Composite::applyDescendant
bool applyDescendant(UnaryProcessor< T > &processor)
Definition composite.h:2024
BALL::Composite::getLastChild
Composite * getLastChild()
BALL::Composite::rendChildComposite
ChildCompositeConstReverseIterator rendChildComposite() const
Definition composite.h:1225
BALL::Composite::isChain
virtual bool isChain() const
Definition composite.h:782
BALL::Composite::isParentOf
bool isParentOf(const Composite &composite) const
BALL::Composite::isSiblingOf
bool isSiblingOf(const Composite &composite) const
BALL::Composite::stamp
void stamp(StampType stamp=BOTH)
BALL::Composite::AncestorIterator
ForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits > AncestorIterator
Definition composite.h:1051
BALL::Composite::CompositeConstReverseIterator
std::reverse_iterator< CompositeConstIterator > CompositeConstReverseIterator
Definition composite.h:1501
BALL::Composite::swap
void swap(Composite &composite)
BALL::Composite::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::Composite::getDepth
Size getDepth() const
BALL::Composite::destroy
virtual void destroy()
BALL::Composite::set
void set(const Composite &composite, bool deep=true)
BALL::Composite::spliceAfter
void spliceAfter(Composite &composite)
BALL::Composite::getSelectionTime
const PreciseTime & getSelectionTime() const
BALL::Composite::rbeginComposite
CompositeReverseIterator rbeginComposite()
Definition composite.h:1490
BALL::Composite::get
void get(Composite &composite, bool deep=true) const
BALL::Composite::isLastChildOf
bool isLastChildOf(const Composite &composite) const
BALL::Composite::insertParent
static bool insertParent(Composite &parent, Composite &first, Composite &last, bool destroy_parent=true)
BALL::Composite::isResidue
virtual bool isResidue() const
Definition composite.h:777
BALL::Composite::endChildComposite
ChildCompositeIterator endChildComposite()
Definition composite.h:1179
BALL::Composite::removeChild
bool removeChild(Composite &child)
BALL::Composite::ChildCompositeConstReverseIterator
std::reverse_iterator< ChildCompositeConstIterator > ChildCompositeConstReverseIterator
Definition composite.h:1218
BALL::Composite::isRelatedWith
bool isRelatedWith(const Composite &composite) const
BALL::Composite::isPreviousSiblingOf
bool isPreviousSiblingOf(const Composite &composite) const
BALL::Composite::isDescendantOf
bool isDescendantOf(const Composite &composite) const
BALL::Composite::getModificationTime
const PreciseTime & getModificationTime() const
BALL::Composite::getFirstChild
Composite * getFirstChild()
BALL::Composite::isInterior
bool isInterior() const
BALL::Composite::DEFAULT_UNARY_PREDICATE
static KernelPredicateType DEFAULT_UNARY_PREDICATE
Definition composite.h:110
BALL::Composite::appendChild
void appendChild(Composite &composite)
BALL::Composite::AncestorConstIterator
ConstForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits > AncestorConstIterator
Definition composite.h:1064
BALL::Composite::isHomomorph
bool isHomomorph(const Composite &composite) const
BALL::Composite::endChildComposite
ChildCompositeConstIterator endChildComposite() const
Definition composite.h:1196
BALL::Composite::ChildCompositeConstIterator
ConstBidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits > ChildCompositeConstIterator
Definition composite.h:1188
BALL::Composite::StampType
StampType
Definition composite.h:94
BALL::Composite::MODIFICATION
@ MODIFICATION
Definition composite.h:97
BALL::Composite::SELECTION
@ SELECTION
Definition composite.h:100
BALL::Composite::BOTH
@ BOTH
Definition composite.h:103
BALL::Composite::deselect
virtual void deselect()
BALL::Composite::clear
virtual void clear()
BALL::Composite::applyDescendantPreorder
bool applyDescendantPreorder(UnaryProcessor< T > &processor)
Definition composite.h:1708
BALL::Composite::DEFAULT_PROCESSOR
static UnaryProcessor< Composite > DEFAULT_PROCESSOR
Definition composite.h:109
BALL::Composite::getLowestCommonAncestor
Composite * getLowestCommonAncestor(const Composite &composite)
BALL::Composite::hasParent
bool hasParent() const
BALL::Composite::isEmpty
bool isEmpty() const
BALL::Composite::hasPreviousSibling
bool hasPreviousSibling() const
BALL::Composite::ChildCompositeIterator
BidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits > ChildCompositeIterator
Definition composite.h:1171
BALL::Composite::hasSibling
bool hasSibling() const
BALL::Composite::isRootOf
bool isRootOf(const Composite &composite) const
BALL::Composite::insertAfter
void insertAfter(Composite &composite)
BALL::Composite::isLastChild
bool isLastChild() const
BALL::Composite::endComposite
CompositeIterator endComposite()
Definition composite.h:1472
BALL::Composite::persistentRead
virtual void persistentRead(PersistenceManager &pm)
BALL::Composite::isRoot
bool isRoot() const
BALL::Composite::containsSelection
bool containsSelection() const
BALL::Composite::removeUnselected
Size removeUnselected()
BALL::Composite::getPathLength
Size getPathLength(const Composite &composite) const
BALL::Composite::beginChildComposite
ChildCompositeIterator beginChildComposite()
Definition composite.h:1173
BALL::Composite::applyChild
bool applyChild(UnaryProcessor< T > &processor)
Definition composite.h:1652
BALL::Composite::spliceBefore
void spliceBefore(Composite &composite)
BALL::Composite::beginComposite
CompositeConstIterator beginComposite() const
Definition composite.h:1477
BALL::Composite::isValid
virtual bool isValid() const
BALL::Composite::ChildCompositeReverseIterator
std::reverse_iterator< ChildCompositeIterator > ChildCompositeReverseIterator
Definition composite.h:1204
BALL::Composite::endComposite
CompositeConstIterator endComposite() const
Definition composite.h:1482
BALL::Composite::isAtom
virtual bool isAtom() const
Definition composite.h:757
BALL::Composite::isProtein
virtual bool isProtein() const
Definition composite.h:767
BALL::Composite::insertBefore
void insertBefore(Composite &composite)
BALL::Composite::isFragment
virtual bool isFragment() const
Definition composite.h:772
BALL::Composite::beginAncestor
AncestorIterator beginAncestor()
Definition composite.h:1053
BALL::Composite::isFirstChildOf
bool isFirstChildOf(const Composite &composite) const
BALL::Composite::CompositeConstIterator
ConstBidirectionalIterator< Composite, Composite, Composite *, CompositeIteratorTraits > CompositeConstIterator
Definition composite.h:1475
BALL::Composite::rendChildComposite
ChildCompositeReverseIterator rendChildComposite()
Definition composite.h:1211
BALL::Composite::splice
void splice(Composite &composite)
BALL::Composite::isMolecule
virtual bool isMolecule() const
Definition composite.h:762
BALL::Composite::rbeginComposite
CompositeConstReverseIterator rbeginComposite() const
Definition composite.h:1503
BALL::Composite::getParent
Composite * getParent()
BALL::Composite::clone
void * clone(Composite &root) const
BALL::Composite::apply
bool apply(ConstUnaryProcessor< T > &processor) const
BALL::Composite::isFirstChild
bool isFirstChild() const
BALL::Composite::endAncestor
AncestorIterator endAncestor()
Definition composite.h:1058
BALL::Composite::select
virtual void select()
BALL::Composite::count
Size count(const KernelPredicateType &predicate) const
BALL::Composite::isChildOf
bool isChildOf(const Composite &composite) const
BALL::Composite::host
void host(Visitor< Composite > &visitor)
BALL::Composite::CompositeIterator
BidirectionalIterator< Composite, Composite, Composite *, CompositeIteratorTraits > CompositeIterator
Definition composite.h:1468
BALL::Composite::apply
bool apply(UnaryProcessor< T > &processor)
BALL::Composite::rendComposite
CompositeConstReverseIterator rendComposite() const
Definition composite.h:1508
BALL::Composite::applyPostorder
bool applyPostorder(UnaryProcessor< T > &processor)
Definition composite.h:1846
BALL::Composite::getHeight
Size getHeight() const
BALL::Composite::beginAncestor
AncestorConstIterator beginAncestor() const
Definition composite.h:1066
BALL::Composite::getAncestor
T * getAncestor(const T &)
BALL::Composite::rbeginChildComposite
ChildCompositeReverseIterator rbeginChildComposite()
Definition composite.h:1206
BALL::Composite::removeSelected
Size removeSelected()
BALL::Composite::applyPreorder
bool applyPreorder(UnaryProcessor< T > &processor)
Definition composite.h:2036
BALL::Composite::deleteChildrenList_
void deleteChildrenList_(std::list< Composite * > &composites)
BALL::Composite::beginComposite
CompositeIterator beginComposite()
Definition composite.h:1470
BALL::Composite::hasNextSibling
bool hasNextSibling() const
BALL::Composite::prependChild
void prependChild(Composite &composite)
BALL::ConstBidirectionalIterator
Definition bidirectionalIterator.h:25
BALL::ConstBidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits >::begin
static ConstBidirectionalIterator begin(const Composite &container)
BALL::ConstBidirectionalIterator< Composite, Composite, Composite *, ChildCompositeIteratorTraits >::end
static ConstBidirectionalIterator end(const Composite &container)
BALL::ConstForwardIterator
Definition forwardIterator.h:26
BALL::ConstForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits >::begin
static ConstForwardIterator begin(const Composite &container)
BALL::ConstForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits >::end
static ConstForwardIterator end(const Composite &container)
BALL::ConstUnaryProcessor
Definition processor.h:120
BALL::ConstUnaryProcessor::finish
virtual bool finish()
Definition processor.h:133
BALL::ConstUnaryProcessor::start
virtual bool start()
Definition processor.h:128
BALL::ForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits >::begin
static ForwardIterator begin(const Composite &container)
BALL::ForwardIterator< Composite, Composite, Composite *, AncestorIteratorTraits >::end
static ForwardIterator end(const Composite &container)
BALL::PersistenceManager
Definition persistenceManager.h:73
BALL::PersistentObject::PersistentObject
PersistentObject()
Definition persistentObject.h:39
BALL::PreciseTime
Definition timeStamp.h:38
BALL::Processor::BREAK
@ BREAK
Definition processor.h:47
BALL::Processor::CONTINUE
@ CONTINUE
Definition processor.h:50
BALL::Processor::Result
int Result
Definition processor.h:36
BALL::Selectable::Selectable
Selectable()
BALL::TimeStamp
Definition timeStamp.h:172
BALL::UnaryPredicate
Definition CONCEPT/predicate.h:30
BALL::UnaryProcessor
Definition processor.h:60
BALL::UnaryProcessor::start
virtual bool start()
Definition processor.h:92
BALL::UnaryProcessor::finish
virtual bool finish()
Definition processor.h:99
BALL::Visitor
Definition visitor.h:23
common.h
comparator.h
BALL_INLINE
#define BALL_INLINE
Definition debug.h:15
BALL_CREATE_DEEP
#define BALL_CREATE_DEEP(name)
Definition create.h:26
BALL::RTTI::isKindOf
bool isKindOf(const U *u)
Definition rtti.h:192
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
object.h
persistentObject.h
processor.h
selectable.h
timeStamp.h
visitor.h