BALL  1.4.1
threads.h
Go to the documentation of this file.
00001 #ifndef BALL_VIEW_KERNEL_THREADS_H
00002 #define BALL_VIEW_KERNEL_THREADS_H
00003 
00004 #ifndef BALL_VIEW_KERNEL_COMMON_H_
00005 #include <BALL/VIEW/KERNEL/common.h>
00006 #endif
00007 
00008 #include <QtCore/QThread>
00009 #include <QtCore/QEvent>
00010 
00011 namespace BALL
00012 {
00013   class EnergyMinimizer;
00014   class MolecularDynamics;
00015   class Composite;
00016   class DockingAlgorithm;
00017   class DCDFile;
00018 
00019 namespace VIEW
00020 {
00021   class MainControl;
00022   class FDPBDialog;
00023   class Message;
00024   class Representation;
00025 
00030   class BALL_VIEW_EXPORT MessageEvent
00031     : public QEvent
00032   {
00033     public:
00034 
00036     MessageEvent(Message* msg = 0)
00037     : QEvent((QEvent::Type)MESSAGE_EVENT),
00038       message_(msg)
00039     {}
00040 
00042     void setMessage(Message* msg) { message_ = msg; }
00043 
00045     Message* getMessage() { return message_; }
00046 
00047     protected:
00048 
00049     Message* message_;
00050   };
00051 
00052 
00069   class BALL_VIEW_EXPORT BALLThread
00070     : public virtual QThread
00071   {
00072     public:
00073 
00075       BALLThread();
00076       
00078       void setMainControl(MainControl* mf) {main_control_ = mf;}
00079       
00081       void setComposite(Composite* composite) {composite_ = composite;}
00082 
00084       Composite* getComposite() { return composite_;}
00085   
00088       virtual void run() {};
00089       
00090       protected:
00091 
00095       void sendMessage_(Message* msg);
00096 
00103       void updateStructure_();
00104 
00106       void output_(const String& string, bool important = false);
00107 
00112       void waitForUpdateOfRepresentations_();
00113   
00114       MainControl*  main_control_;
00115       Composite*    composite_;
00116     };
00117 
00119   class BALL_VIEW_EXPORT CalculateFDPBThread
00120     : public BALLThread
00121   {
00122     public:
00123 
00125       CalculateFDPBThread();
00126 
00128       virtual void run();
00129 
00131       void setFDPBDialog(FDPBDialog* dialog) {dialog_ = dialog;}
00132 
00133     protected:
00134       FDPBDialog* dialog_;
00135   };
00136 
00137 
00139   class BALL_VIEW_EXPORT UpdateRepresentationThread
00140     : public BALLThread
00141   {
00142     public:
00143 
00145       UpdateRepresentationThread();
00146 
00148       virtual void run();
00149 
00151       void setRepresentation(Representation& rep)
00152         { rep_ = &rep;}
00153 
00155       Representation* getRepresentation()
00156         { return rep_; }
00157 
00158     protected:
00159 
00160       Representation* rep_;
00161   };
00162 
00163 
00169   class BALL_VIEW_EXPORT SimulationThread
00170     : public BALLThread
00171   {
00172     public:
00173 
00175       SimulationThread();
00176 
00178       void setNumberOfStepsBetweenUpdates(Size steps)
00179         { steps_between_updates_ = steps;}
00180 
00182       void setDCDFile(DCDFile* file) {dcd_file_ = file;}
00183 
00185       DCDFile* getDCDFile() { return dcd_file_;}
00186 
00187       protected:
00188   
00190       void exportSceneToPNG_();
00191 
00193       void finish_();
00194 
00195       Size          steps_between_updates_;
00196       DCDFile*      dcd_file_;
00197     };
00198 
00199 
00201     class BALL_VIEW_EXPORT EnergyMinimizerThread
00202       : public SimulationThread
00203     {
00204       public:
00205 
00207         EnergyMinimizerThread();
00208         
00210         virtual ~EnergyMinimizerThread();
00211         
00213         virtual void run();
00214 
00216         void setEnergyMinimizer(EnergyMinimizer* minimizer);
00217 
00218       protected:
00219         EnergyMinimizer* minimizer_;
00220     };
00221 
00222 
00224     class BALL_VIEW_EXPORT MDSimulationThread
00225       : public SimulationThread
00226     {
00227       public:
00228 
00230         MDSimulationThread();
00231         
00233         virtual ~MDSimulationThread();
00234         
00236         virtual void run()
00237           throw(Exception::NullPointer);
00238 
00240         void setMolecularDynamics(MolecularDynamics* md);
00241 
00243         void setNumberOfSteps(Size steps) { steps_ = steps;}
00244 
00246         void setSaveImages(bool state) { save_images_ = state;}
00247 
00248       protected:
00249         MolecularDynamics* md_;
00250         Size steps_;
00251         bool save_images_;
00252     };
00253 
00254 
00256     class BALL_VIEW_EXPORT DockingThread
00257       : public BALLThread
00258     {
00259       public:
00261         DockingThread();
00262         
00264         virtual ~DockingThread();
00265         
00268         const DockingThread& operator =(const DockingThread& dock_thread);
00269           
00271         void setDockingAlgorithm(DockingAlgorithm* dock_alg);
00272           
00274         virtual void run()
00275           throw(Exception::NullPointer);
00276           
00277       protected:
00278         DockingAlgorithm* dock_alg_;
00279     };
00280   
00281   }
00282 }
00283 #endif //BALL_VIEW_KERNEL_THREADS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines