LAMA
|
00001 00033 #ifndef LAMA_SolverCreator_HPP_ 00034 #define LAMA_SolverCreator_HPP_ 00035 00036 // for dll_import 00037 #include <lama/config.hpp> 00038 00039 // others 00040 #include <lama/solver/Solver.hpp> 00041 00042 // macros 00043 #include <lama/macros/unique_name.hpp> 00044 00045 #include <lama/solver/creator/Creator.hpp> 00046 00047 // spirit 00048 #include <boost/spirit/include/qi.hpp> 00049 00050 #include <string> 00051 00052 00053 #define LAMA_PARAMETER_ENTRY( key, grammarInput, instance, className, setterFunction ) \ 00054 -( lit(key) \ 00055 >> lit('=') \ 00056 >> grammarInput \ 00057 [ phoenix::bind(&className::setterFunction, *dynamic_cast_<className*>( instance ), _1 ) ] \ 00058 >> lit(';') ) 00059 00060 namespace lama 00061 { 00062 00063 namespace qi = boost::spirit::qi; 00064 namespace ascii = boost::spirit::ascii; 00065 namespace phoenix = boost::phoenix; 00066 00067 class MetaSolver; 00068 00072 class LAMA_DLL_IMPORTEXPORT SolverCreator : Creator 00073 { 00074 public: 00075 typedef qi::rule<std::string::const_iterator, Solver*(), ascii::space_type> RuleType; 00076 00077 virtual ~SolverCreator(); 00078 00082 virtual RuleType& getCreatorRule() = 0; 00083 00084 protected: 00085 typedef qi::rule<std::string::const_iterator, void( Solver* ), ascii::space_type> InternRuleType; 00086 00087 using Creator::mRScalar; 00088 using Creator::mRId; 00089 00090 SolverCreator(); 00091 00096 qi::rule<std::string::const_iterator, SolverPtr(), ascii::space_type> mRSolverReference; 00097 00101 InternRuleType mRSolver; 00102 00103 private: 00104 LAMA_LOG_DECL_STATIC_LOGGER(logger); 00105 }; 00106 00110 #define LAMA_SOLVERCREATOR_REGISTRATION(creatorType) \ 00111 static lama::creatorType \ 00112 LAMA_UNIQUE_NAME( solRegObj, creatorType )(creatorType::id()) 00113 00114 } 00115 00116 #endif // LAMA_SolverCreator_HPP_