00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_VIEW_KERNEL_COMPOSITEMANAGER_H 00006 #define BALL_VIEW_KERNEL_COMPOSITEMANAGER_H 00007 00008 #ifndef BALL_DATATYPE_HASHSET_H 00009 # include <BALL/DATATYPE/hashSet.h> 00010 #endif 00011 00012 namespace BALL 00013 { 00014 class Composite; 00015 class System; 00016 00017 namespace VIEW 00018 { 00026 class BALL_VIEW_EXPORT CompositeManager 00027 { 00028 public: 00032 typedef Composite* value_type; 00033 typedef Composite *& reference; 00034 typedef Composite** pointer; 00035 typedef const Composite*& const_reference; 00036 typedef const Composite** const_pointer; 00037 typedef Index difference_type; 00038 typedef Size size_type; 00039 typedef HashSet<Composite*>::Iterator iterator; 00040 00042 typedef HashSet<Composite*>::Iterator CompositeIterator; 00043 00045 typedef HashSet<Composite*>::ConstIterator CompositeConstIterator; 00046 00048 00051 00054 CompositeManager(); 00055 00058 CompositeManager(const CompositeManager& cm); 00059 00062 virtual ~CompositeManager(); 00063 00066 virtual void clear(); 00067 00069 00072 00076 bool has(const Composite* composite) const; 00077 00081 bool hasRoot(const Composite* composite) const; 00082 00084 00087 00092 bool insert(Composite& composite); 00093 00097 void remove(Composite& composite, bool to_delete = true); 00098 00101 Size getNumberOfComposites() const 00102 { return composite_set_.size();} 00103 00105 00108 00110 CompositeIterator begin() 00111 { return composite_set_.begin();} 00112 00114 CompositeIterator end() 00115 { return composite_set_.end();} 00116 00118 CompositeConstIterator begin() const 00119 { return composite_set_.begin();} 00120 00122 CompositeConstIterator end() const 00123 { return composite_set_.end();} 00124 00126 HashSet<Composite*>& getComposites() 00127 { return composite_set_;} 00128 00130 const HashSet<Composite*>& getComposites() const 00131 { return composite_set_;} 00132 00138 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const; 00139 00141 00142 private: 00143 00144 HashSet<Composite*> composite_set_; 00145 HashSet<String> name_set_; 00146 }; 00147 00148 } // namespace VIEW 00149 } // namespace BALL 00150 00151 #endif // BALL_VIEW_KERNEL_COMPOSITEMANAGER_H