Diana  0.8.3
DianaSolver.hpp
00001 /* -----------------------------------------------------------------------------
00002  *  Diana process modelling, simulation and analysis software
00003  *  Copyright (c) 2005, Michael Krasnyk
00004  *  All rights reserved.
00005  *
00006  *  This file is a part of Diana process modelling, simulation and analysis software
00007  *
00008  *  Diana is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published
00010  *  by the Free Software Foundation (see accompanying file LICENSE)
00011  * -----------------------------------------------------------------------------
00012  *  $Id: DianaSolver.hpp 8160 2009-03-16 18:36:30Z miha $
00013  * -----------------------------------------------------------------------------
00014  *  Description:
00015  */
00016 
00017 #ifndef DIANA_SOLVER_H
00018 #define DIANA_SOLVER_H
00019 
00020 #include <CapeOpen.hpp>
00021 #include <Diana/DianaModel.hpp>
00022 
00023 #ifdef _MSC_VER
00024 char *dlerror();
00025 #define dlsym GetProcAddress
00026 #endif
00027 
00028 extern "C" {
00030   typedef Numeric::Solvers::Solver::ICapeNumericSolver* (*fCreateSolver)(Numeric::Solvers::Solver::CapeSolverType typeOfSolver,
00031                                                                          Numeric::Solvers::Model::ICapeNumericModel* model);
00032 }
00033 
00034 namespace Diana{
00035 
00039   class DianaSolverFactory : public Numeric::Solvers::Solver::ICapeNumericSolverFactory {
00040   public:
00046     Numeric::Solvers::Solver::ICapeNumericSolver* CreateSolver(Numeric::Solvers::Solver::CapeSolverType type,
00047                                                                Numeric::Solvers::Model::ICapeNumericModel* theModel,
00048                                                                Common::Types::CapeString strLibraryName)
00049       throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument,
00050              Common::Error::ECapeOutOfBounds, Common::Error::ECapeOutOfResources,
00051              Common::Error::ECapeFailedInitialisation, Common::Error::ECapeUser);
00052 
00054     void Shutdown()
00055       throw (Common::Error::ECapeUnknown, Common::Error::ECapeNoImpl);
00056   };
00057 
00063   class DianaNumericSolver : virtual public IDianaNumericSolver {
00064   public:
00065 
00068     ~DianaNumericSolver();
00069     
00082     void SetReportingInterface(Diana::IDianaReporting* _pReportingInterface)
00083       throw (Common::Error::ECapeUnknown);
00084 
00085     void RemoveReportingInterface(Diana::IDianaReporting* _pReportingInterface)
00086       throw (Common::Error::ECapeUnknown);
00087     
00088   protected:
00091     void notifyEventHandlers(SolverEvents event) throw (Common::Error::ECapeUnknown, Common::Error::ECapeInvalidArgument, Common::Error::ECapeFailedInitialisation);
00092 
00093     bool areEventHandlers();
00094 
00095   private:
00096     std::vector<Diana::IDianaReporting*>  arrReportingInterfaces; 
00097   };
00098 
00099 };
00100 
00101 #endif // DIANA_SOLVER_H