Skip to content
Snippets Groups Projects
Select Git revision
  • ba3257c8da4bbfc19416418b31a7ccdf0629fd2d
  • master default protected
2 results

ASimulationEngine.h

Blame
  • ASimulationEngine.h 4.30 KiB
    /*************************************************************************
     *   Copyright (C) 2007 by Oliver Bock                                   *
     *   bock@tfh-berlin.de                                                  *
     *                                                                       *
     *   This file is part of Fidelity.                                      *
     *                                                                       *
     *   Fidelity is free software: you can redistribute it and/or modify    *
     *   it under the terms of the GNU General Public License as published   *
     *   by the Free Software Foundation, version 3 of the License.          *
     *                                                                       *
     *   Fidelity is distributed in the hope that it will be useful,         *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of      *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        *
     *   GNU General Public License for more details.                        *
     *                                                                       *
     *   You should have received a copy of the GNU General Public License   *
     *   along with Fidelity. If not, see <http://www.gnu.org/licenses/>.    *
     *                                                                       *
     *************************************************************************/
    
    #ifndef ASIMULATIONENGINE_H
    #define ASIMULATIONENGINE_H
    
    #include "ISimulationEngine.h"
    
    using namespace Fidelity::Engine;
    
    namespace Fidelity {
    	namespace Engine {
    
    /**
     * @author Oliver Bock <bock@tfh-berlin.de>
     * 
     * This abstract class defines all members which are common to all concrete SimulationEngines
     */
    class ASimulationEngine : public ISimulationEngine
    {
    	Q_OBJECT
    public:
    	/**
    	 * Constructor
    	 */
    	ASimulationEngine();
    
    	/**
    	 * Destructor
    	 */
    	virtual ~ASimulationEngine();
    
    	// Accessor methods
    
    	/**
    	 * Get the value of m_ParameterTable.<br>
    	 * This hashtable holds all parameters of the engine. Parameters are members of the concrete classes that implement ISimulation Engine.
    	 * They are assigned to this hashtable in the constructor of that classes.
    	 * @return The value of m_ParameterTable.
    	 */
    	ParameterTable* ParamTable() const;
    
    	/**
    	 * Set the value of m_SimulationSetup.<br>
    	 * This member holds the complete optical setup of the simulation. All components are given in a ComponentTable.
    	 * @param setup The new value of m_SimulationSetup.
    	 */
    	void setSimSetup(SimulationSetup* setup);
    
    	/**
    	 * Get the value of m_SimulationSetup.<br>
    	 * This member holds the complete optical setup of the simulation. All components are given in a ComponentTable.
    	 * @return The value of m_SimulationSetup.
    	 */
    	SimulationSetup* SimSetup() const;
    
    public slots:
    	/**
    	 * Pause the simulation run.
    	 * @return TRUE if the pause request was successful.
    	 */
    	virtual bool pause();
    
    	/**
    	 * Resume the simulation run.
    	 * @return TRUE if the resume request was successful.
    	 */
    	virtual bool resume();
    
    	/**
    	 * Stop the simulation run.
    	 * @param save Set to TRUE if you want the simulation status to be saved for a possible restart at a later time.
    	 * @return TRUE if the stop request was successful.
    	 */
    	virtual bool stop(bool save);
    
    signals:
    	/**
    	 * This signal is emitted when a simulation is initialised.<br>
    	 * It indicates the total amount of iterations during the upcoming simulation run.
    	 * @param iterations The total amount of iterations during the upcoming simulation run.
    	 */
    	void simulationProgressInit(const long iterations);
    
    	/**
    	 * This signal is emitted when a certain number of iterations is completed.<br>
    	 * @param iteration The current number of completed iterations.
    	 */
    	void simulationProgressStep(long iteration);
    
    protected:
    	/**
    	 * This hashtable holds all parameters of the engine.<br>
    	 * Parameters are members of the concrete classes that implement ISimulation Engine.
    	 * They are assigned to this hashtable in the constructor of that classes.
    	 */
    	ParameterTable* m_ParamTable;
    
    	/**
    	 * This member holds the complete optical setup of the simulation.<br>
    	 * All components are given in a ComponentTable.
    	 */
    	SimulationSetup* m_SimulationSetup;
    
    private:
    	/**
    	 * Initialise private members of this class.
    	 * Called in the Constructor of this class.
    	 */
    	void initAttributes();
    };}}
    
    #endif