00001
00002
00003
00004
00005
00006 #ifndef BALL_VIEW_KERNEL_COMPOSITEMANAGER_H
00007 #define BALL_VIEW_KERNEL_COMPOSITEMANAGER_H
00008
00009 #ifndef BALL_DATATYPE_HASHSET_H
00010 # include <BALL/DATATYPE/hashSet.h>
00011 #endif
00012
00013 namespace BALL
00014 {
00015 class Composite;
00016 class System;
00017
00018 namespace VIEW
00019 {
00027 class BALL_VIEW_EXPORT CompositeManager
00028 {
00029 public:
00033 typedef Composite* value_type;
00034 typedef Composite *& reference;
00035 typedef Composite** pointer;
00036 typedef const Composite*& const_reference;
00037 typedef const Composite** const_pointer;
00038 typedef Index difference_type;
00039 typedef Size size_type;
00040 typedef HashSet<Composite*>::Iterator iterator;
00041
00043 typedef HashSet<Composite*>::Iterator CompositeIterator;
00044
00046 typedef HashSet<Composite*>::ConstIterator CompositeConstIterator;
00047
00049
00052
00055 CompositeManager();
00056
00059 CompositeManager(const CompositeManager& cm);
00060
00063 virtual ~CompositeManager();
00064
00067 virtual void clear();
00068
00070
00073
00077 bool has(const Composite* composite) const;
00078
00082 bool hasRoot(const Composite* composite) const;
00083
00085
00088
00093 bool insert(Composite& composite);
00094
00098 void remove(Composite& composite, bool to_delete = true);
00099
00102 Size getNumberOfComposites() const
00103 { return composite_set_.size();}
00104
00106
00109
00111 CompositeIterator begin()
00112 { return composite_set_.begin();}
00113
00115 CompositeIterator end()
00116 { return composite_set_.end();}
00117
00119 CompositeConstIterator begin() const
00120 { return composite_set_.begin();}
00121
00123 CompositeConstIterator end() const
00124 { return composite_set_.end();}
00125
00127 HashSet<Composite*>& getComposites()
00128 { return composite_set_;}
00129
00131 const HashSet<Composite*>& getComposites() const
00132 { return composite_set_;}
00133
00139 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00140
00142
00143 private:
00144
00145 HashSet<Composite*> composite_set_;
00146 HashSet<String> name_set_;
00147 };
00148
00149 }
00150 }
00151
00152 #endif // BALL_VIEW_KERNEL_COMPOSITEMANAGER_H