BALL  1.5.0
representationManager.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: representationManager.h,v 1.1.4.2 2007/03/28 13:11:43 amoll Exp $
5 
6 #ifndef BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
7 #define BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
8 
9 #ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
11 #endif
12 
13 #ifndef BALL_SYSTEM_MUTEX_H
14 #include <BALL/SYSTEM/mutex.h>
15 #endif
16 
17 #include <QtCore/QCoreApplication>
18 #include <QtCore/QWaitCondition>
19 
20 #include <vector>
21 
22 using std::vector;
23 
24 namespace BALL
25 {
26  class Composite;
27  class INIFile;
28 
29  namespace VIEW
30  {
31  class MainControl;
32  class UpdateRepresentationThread;
33  class ClippingPlane;
34 
46  : public Object
47  {
48  friend class Representation;
50  friend class BALLThread;
51  friend class MainControl;
52 
53  public:
54 
56 
57 
63 
66 
69 
71 
74 
79 
83 
87 
89 
92 
94  const RepresentationManager& operator = (const RepresentationManager& pm);
95 
97  bool operator == (const RepresentationManager& pm) const;
98 
100  void clear();
101 
108  bool remove(Representation& representation, bool send_message = true);
109 
114  bool insert(Representation& representation, bool send_message = true);
115 
117  const RepresentationList& getRepresentations() const
118  { return representations_;}
119 
122  { return representations_.size();}
123 
126 
128  bool has(const Representation& representation) const;
129 
131  void dump(std::ostream& s, Size depth = 0) const;
132 
135  { return representations_.begin();}
136 
139  { return representations_.begin();}
140 
143  { return representations_.end();}
144 
147  { return representations_.end();}
148 
156  RepresentationList removedComposite(const Composite& composite, bool update = true);
157 
163 
166 
168  const vector<ClippingPlane*>& getClippingPlanes() const { return clipping_planes_;}
169 
172 
175 
178 
180  void restoreRepresentations(const INIFile& in, const vector<const Composite*>& new_systems);
181 
184 
186  bool willBeUpdated(const Representation& rep) const;
187 
189  bool updateRunning() const ;
190 
193 
196 
198  bool isBeeingRendered(const Representation* rep) const;
199 
200  protected:
201 
204 
206 
207  /*_ Called by Representation::update() to start a multithreaded
208  Update of the Representation.
209  (Only used in Multithreaded code.)
210  */
212 
213  //_ List with all representations
215 
219 
220  vector<ClippingPlane*> clipping_planes_;
221 
222  // we need to ensure that the mutex is always created correctly before
223  // the thread that tries to access it!
225 
229 
231  };
232 
233  } // namespace VIEW
234 } // namespace BALL
235 
236 #endif // BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
#define BALL_CREATE(name)
Definition: create.h:62
Definition: constants.h:13
std::list< Representation * > RepresentationList
RepresentationsConstIterator end() const
Const Iterator pointing behind the last Representation.
RepresentationList removedComposite(const Composite &composite, bool update=true)
HashSet< Representation * > beeing_rendered_
vector< ClippingPlane * > clipping_planes_
HashSet< Representation * > beeing_updated_
bool removeClippingPlane(ClippingPlane *plane)
void dump(std::ostream &s, Size depth=0) const
Dump the internal state to an output stream.
Representation * createRepresentation()
Create a Representation and insert it.
bool willBeUpdated(const Representation &rep) const
Return true if a Representation will be updated.
void insertClippingPlane(ClippingPlane *plane)
HashSet< Representation * > to_update_
void restoreRepresentations(const INIFile &in, const vector< const Composite * > &new_systems)
UpdateRepresentationThread * thread_
void update_(Representation &rep)
void finishedUpdate_(Representation *rep)
RepresentationList::iterator RepresentationsIterator
Iteration to the Representations.
bool startRendering(Representation *rep)
RepresentationList::const_iterator RepresentationsConstIterator
ConstIterator to the Representations.
RepresentationsConstIterator begin() const
ConstIterator to the first Representation.
void finishedRendering(Representation *rep)
RepresentationsIterator end()
Iterator pointing behind the last Representation.
bool has(const Representation &representation) const
Test if a Representation is inserted.
RepresentationList getRepresentationsOf(const Composite &composite)
Representation * popRepresentationToUpdate()
void focusRepresentation(const Representation &rep)
Size getNumberOfRepresentations() const
Get the number of the Representations.
RepresentationsIterator begin()
Iterator to the first Representation.
bool isBeeingRendered(const Representation *rep) const
Used by UpdateRepresentationThread.
void storeRepresentations(INIFile &out)
const vector< ClippingPlane * > & getClippingPlanes() const
bool updateRunning() const
Return true, if a Representation is currently beeing updated.
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52