/usr/include/BALL/VIEW/KERNEL/representationManager.h is in libballview1.4-dev 1.4.3~beta1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: representationManager.h,v 1.1.4.2 2007/03/28 13:11:43 amoll Exp $
#ifndef BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
#define BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
#ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
# include <BALL/VIEW/KERNEL/representation.h>
#endif
#ifndef BALL_SYSTEM_MUTEX_H
#include <BALL/SYSTEM/mutex.h>
#endif
#include <QtCore/QCoreApplication>
#include <QtCore/QWaitCondition>
#include <vector>
using std::vector;
namespace BALL
{
class Composite;
class INIFile;
namespace VIEW
{
class MainControl;
class UpdateRepresentationThread;
class ClippingPlane;
/** RepresentationManager manages the graphical Representation objects and all GeometricObject.
All Representation objects which shall be inserted should be created using createRepresentation().
When the RepresentationManager is destroyed, all inserted Representation are deleted.
The RepresentationManager has also the capability for multithreaded updateing of
the Representation's:\\
Representation::update() calls RepresentationManager::update_(Representation)\\
if the code is build with support for multithreading. The update itself
is done in an instance of UpdateRepresentationThread.
\ingroup ViewKernelGeometricPrimitives
*/
class BALL_VIEW_EXPORT RepresentationManager
: public Object
{
friend class Representation;
friend class UpdateRepresentationThread;
friend class BALLThread;
friend class MainControl;
public:
BALL_CREATE(RepresentationManager)
/** @name Type definitions
*/
//@{
///
///
typedef HashSet<Representation*> RepresentationSet;
/// Iteration to the Representations
typedef RepresentationList::iterator RepresentationsIterator;
/// ConstIterator to the Representations
typedef RepresentationList::const_iterator RepresentationsConstIterator;
//@}
/** @name Constructors and Destructor
*/
//@{
/** Default Constructor
The MainControl is needed for sending Messages.
*/
RepresentationManager(MainControl* mc = 0);
/** Copy constructor
*/
RepresentationManager(const RepresentationManager& pm);
/** Destructor
*/
virtual ~RepresentationManager();
//@}
/** @name Accessors
*/
//@{
///
const RepresentationManager& operator = (const RepresentationManager& pm);
///
bool operator == (const RepresentationManager& pm) const;
/// Clears also the representations
void clear();
/** Delete a representation.
It will be removed from the list of representations,
its GeometricObject will be deleted.
If send_message is set to true, a RepresentationMessage with
type REMOVE is send to notify all ModularWidget's.
*/
bool remove(Representation& representation, bool send_message = true);
/** Insert a Representation
If send_message is set to true, a RepresentationMessage with
type ADD is send to notify all ModularWidget's.
*/
bool insert(Representation& representation, bool send_message = true);
/// Get the list with the Representations
const RepresentationList& getRepresentations() const
{ return representations_;}
/// Get the number of the Representations
Size getNumberOfRepresentations() const
{ return representations_.size();}
/// Create a Representation and insert it
Representation* createRepresentation();
/// Test if a Representation is inserted
bool has(const Representation& representation) const;
/// Dump the internal state to an output stream
void dump(std::ostream& s, Size depth = 0) const;
/// Iterator to the first Representation
RepresentationsIterator begin()
{ return representations_.begin();}
/// ConstIterator to the first Representation
RepresentationsConstIterator begin() const
{ return representations_.begin();}
/// Iterator pointing behind the last Representation
RepresentationsIterator end()
{ return representations_.end();}
/// Const Iterator pointing behind the last Representation
RepresentationsConstIterator end() const
{ return representations_.end();}
/** Clean up after a Composite was removed.
Method is called in MainControl, after removal of
a composite (e.g. a System) and it removes all
representations, which contain the Composite.
It can also update all Representations, which have still have other Composites than the one to be deleted.
\return a list with the pointers of all removed representations.
*/
RepresentationList removedComposite(const Composite& composite, bool update = true);
/** Get a list of Representation, which were build for a Composite.
Method is called in MainControl, after receiving CompositeChangedMessage.
\return a list with the pointers of representations, which are to be updated.
*/
RepresentationList getRepresentationsOf(const Composite& composite);
///
void rebuildAllRepresentations();
///
const vector<ClippingPlane*>& getClippingPlanes() const { return clipping_planes_;}
///
bool removeClippingPlane(ClippingPlane* plane);
///
void insertClippingPlane(ClippingPlane* plane);
///
void storeRepresentations(INIFile& out);
///
void restoreRepresentations(const INIFile& in, const vector<const Composite*>& new_systems);
///
void focusRepresentation(const Representation& rep);
/// Return true if a Representation will be updated
bool willBeUpdated(const Representation& rep) const;
/// Return true, if a Representation is currently beeing updated
bool updateRunning() const ;
///
bool startRendering(Representation* rep);
///
void finishedRendering(Representation* rep);
/// Used by UpdateRepresentationThread
bool isBeeingRendered(const Representation* rep) const;
protected:
///
Representation* popRepresentationToUpdate();
void finishedUpdate_(Representation* rep);
/*_ Called by Representation::update() to start a multithreaded
Update of the Representation.
(Only used in Multithreaded code.)
*/
void update_(Representation& rep);
//_ List with all representations
RepresentationList representations_;
HashSet<Representation*> beeing_rendered_;
HashSet<Representation*> beeing_updated_;
HashSet<Representation*> to_update_;
vector<ClippingPlane*> clipping_planes_;
// we need to ensure that the mutex is always created correctly before
// the thread that tries to access it!
mutable Mutex update_mutex_;
UpdateRepresentationThread* thread_;
bool no_update_;
bool still_to_notify_;
MainControl* main_control_;
};
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_KERNEL_REPRESENTATIONMANAGER_H
|