Loading...
Searching...
No Matches
representationManager.h
Go to the documentation of this file.
// -*- 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;
class BALL_VIEW_EXPORT RepresentationManager
: public Object
{
friend class Representation;
friend class UpdateRepresentationThread;
friend class BALLThread;
friend class MainControl;
public:
BALL_CREATE(RepresentationManager)
typedef HashSet<Representation*> RepresentationSet;
typedef RepresentationList::iterator RepresentationsIterator;
typedef RepresentationList::const_iterator RepresentationsConstIterator;
RepresentationManager(MainControl* mc = 0);
RepresentationManager(const RepresentationManager& pm);
virtual ~RepresentationManager();
const RepresentationManager& operator = (const RepresentationManager& pm);
bool operator == (const RepresentationManager& pm) const;
void clear();
bool remove(Representation& representation, bool send_message = true);
bool insert(Representation& representation, bool send_message = true);
const RepresentationList& getRepresentations() const
{ return representations_;}
Size getNumberOfRepresentations() const
{ return representations_.size();}
Representation* createRepresentation();
bool has(const Representation& representation) const;
void dump(std::ostream& s, Size depth = 0) const;
RepresentationsIterator begin()
{ return representations_.begin();}
RepresentationsConstIterator begin() const
{ return representations_.begin();}
RepresentationsIterator end()
{ return representations_.end();}
RepresentationsConstIterator end() const
{ return representations_.end();}
RepresentationList removedComposite(const Composite& composite, bool update = true);
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);
bool willBeUpdated(const Representation& rep) const;
bool updateRunning() const ;
bool startRendering(Representation* rep);
void finishedRendering(Representation* rep);
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
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
BALL::Composite
Definition composite.h:74
BALL::HashSet
Definition hashSet.h:46
BALL::INIFile
Definition INIFile.h:29
BALL::Object::Object
Object()
Default constructor.
BALL::VIEW::ClippingPlane
Definition clippingPlane.h:26
BALL::VIEW::MainControl
Definition mainControl.h:118
BALL::VIEW::RepresentationManager::end
RepresentationsConstIterator end() const
Const Iterator pointing behind the last Representation.
Definition representationManager.h:146
BALL::VIEW::RepresentationManager::main_control_
MainControl * main_control_
Definition representationManager.h:230
BALL::VIEW::RepresentationManager::removedComposite
RepresentationList removedComposite(const Composite &composite, bool update=true)
BALL::VIEW::RepresentationManager::beeing_rendered_
HashSet< Representation * > beeing_rendered_
Definition representationManager.h:216
BALL::VIEW::RepresentationManager::clipping_planes_
vector< ClippingPlane * > clipping_planes_
Definition representationManager.h:220
BALL::VIEW::RepresentationManager::getRepresentations
const RepresentationList & getRepresentations() const
Get the list with the Representations.
Definition representationManager.h:117
BALL::VIEW::RepresentationManager::popRepresentationToUpdate
Representation * popRepresentationToUpdate()
BALL::VIEW::RepresentationManager::beeing_updated_
HashSet< Representation * > beeing_updated_
Definition representationManager.h:217
BALL::VIEW::RepresentationManager::no_update_
bool no_update_
Definition representationManager.h:227
BALL::VIEW::RepresentationManager::removeClippingPlane
bool removeClippingPlane(ClippingPlane *plane)
BALL::VIEW::RepresentationManager::representations_
RepresentationList representations_
Definition representationManager.h:214
BALL::VIEW::RepresentationManager::MainControl
friend class MainControl
Definition representationManager.h:51
BALL::VIEW::RepresentationManager::createRepresentation
Representation * createRepresentation()
Create a Representation and insert it.
BALL::VIEW::RepresentationManager::still_to_notify_
bool still_to_notify_
Definition representationManager.h:228
BALL::VIEW::RepresentationManager::dump
void dump(std::ostream &s, Size depth=0) const
Dump the internal state to an output stream.
BALL::VIEW::RepresentationManager::willBeUpdated
bool willBeUpdated(const Representation &rep) const
Return true if a Representation will be updated.
BALL::VIEW::RepresentationManager::insertClippingPlane
void insertClippingPlane(ClippingPlane *plane)
BALL::VIEW::RepresentationManager::to_update_
HashSet< Representation * > to_update_
Definition representationManager.h:218
BALL::VIEW::RepresentationManager::restoreRepresentations
void restoreRepresentations(const INIFile &in, const vector< const Composite * > &new_systems)
BALL::VIEW::RepresentationManager::RepresentationManager
RepresentationManager(MainControl *mc=0)
BALL::VIEW::RepresentationManager::remove
bool remove(Representation &representation, bool send_message=true)
BALL::VIEW::RepresentationManager::thread_
UpdateRepresentationThread * thread_
Definition representationManager.h:226
BALL::VIEW::RepresentationManager::RepresentationSet
HashSet< Representation * > RepresentationSet
Definition representationManager.h:62
BALL::VIEW::RepresentationManager::getClippingPlanes
const vector< ClippingPlane * > & getClippingPlanes() const
Definition representationManager.h:168
BALL::VIEW::RepresentationManager::UpdateRepresentationThread
friend class UpdateRepresentationThread
Definition representationManager.h:49
BALL::VIEW::RepresentationManager::update_
void update_(Representation &rep)
BALL::VIEW::RepresentationManager::finishedUpdate_
void finishedUpdate_(Representation *rep)
BALL::VIEW::RepresentationManager::RepresentationsIterator
RepresentationList::iterator RepresentationsIterator
Iteration to the Representations.
Definition representationManager.h:65
BALL::VIEW::RepresentationManager::startRendering
bool startRendering(Representation *rep)
BALL::VIEW::RepresentationManager::RepresentationsConstIterator
RepresentationList::const_iterator RepresentationsConstIterator
ConstIterator to the Representations.
Definition representationManager.h:68
BALL::VIEW::RepresentationManager::insert
bool insert(Representation &representation, bool send_message=true)
BALL::VIEW::RepresentationManager::begin
RepresentationsConstIterator begin() const
ConstIterator to the first Representation.
Definition representationManager.h:138
BALL::VIEW::RepresentationManager::clear
void clear()
Clears also the representations.
BALL::VIEW::RepresentationManager::finishedRendering
void finishedRendering(Representation *rep)
BALL::VIEW::RepresentationManager::BALLThread
friend class BALLThread
Definition representationManager.h:50
BALL::VIEW::RepresentationManager::Representation
friend class Representation
Definition representationManager.h:48
BALL::VIEW::RepresentationManager::end
RepresentationsIterator end()
Iterator pointing behind the last Representation.
Definition representationManager.h:142
BALL::VIEW::RepresentationManager::has
bool has(const Representation &representation) const
Test if a Representation is inserted.
BALL::VIEW::RepresentationManager::getRepresentationsOf
RepresentationList getRepresentationsOf(const Composite &composite)
BALL::VIEW::RepresentationManager::update_mutex_
Mutex update_mutex_
Definition representationManager.h:224
BALL::VIEW::RepresentationManager::focusRepresentation
void focusRepresentation(const Representation &rep)
BALL::VIEW::RepresentationManager::rebuildAllRepresentations
void rebuildAllRepresentations()
BALL::VIEW::RepresentationManager::getNumberOfRepresentations
Size getNumberOfRepresentations() const
Get the number of the Representations.
Definition representationManager.h:121
BALL::VIEW::RepresentationManager::begin
RepresentationsIterator begin()
Iterator to the first Representation.
Definition representationManager.h:134
BALL::VIEW::RepresentationManager::isBeeingRendered
bool isBeeingRendered(const Representation *rep) const
Used by UpdateRepresentationThread.
BALL::VIEW::RepresentationManager::storeRepresentations
void storeRepresentations(INIFile &out)
BALL::VIEW::RepresentationManager::updateRunning
bool updateRunning() const
Return true, if a Representation is currently beeing updated.
BALL::VIEW::UpdateRepresentationThread
Definition threads.h:161
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
mutex.h
BALL::VIEW
Definition constraints.h:35
BALL::VIEW::RepresentationList
std::list< Representation * > RepresentationList
Definition representation.h:342
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Mutex
TMutex< BALL_DEFAULT_MUTEX_TYPE > Mutex
Definition mutex.h:224
representation.h