#ifndef headerfilecalculation #define headerfilecalculation /*! \file parsermanager.h \brief object of type ParserManager we're using during calculating */ #include "resource.h" #include #include "programresources.h" #include /*! \brief object of type ParserManager we're using during calculating In our program we're using three kind of precisions. First is the smallest , and the third is the biggest. Because precision is established during compilation (templates) we need three different objects. ParserManager helps us to maintain these objects. */ class ParserManager { public: ParserManager(); ParserManager(const ParserManager & p); ParserManager & operator=(const ParserManager & p); ~ParserManager(); /*! the main method which call parserX.Parse(...) */ ttmath::ErrorCode Parse(); /*! we call this method directly after when we have left WaitForCalculatingAndBlockForStop() method from the ThreadController only in this method we can read variables which can be changed by the first thread */ void MakeCopyOfVariables(); /*! it prepares our three parsers to work, it should be called only once */ void Init(); /*! this method prints result (a correct value if was or an error instead) */ void PrintResult(); private: ttmath::Parser > parser1; ttmath::Parser > parser2; ttmath::Parser > parser3; ttmath::Objects variables, functions; const unsigned int buffer_len; char * buffer; int base_input, base_output; bool always_scientific; int when_scientific; int rounding; int precision; Languages::Country country; ttmath::ErrorCode code; template void PrintResult(ttmath::Parser & matparser) { std::string result, part; unsigned int i = 0; for(i=0 ; iGetLanguages()->GuiMessage(country, Languages::overflow_during_printing); // will be working correctly on gcc with -O3 // this error doesn't appear always, it can be seen, for example, // if we use Big<1,3> type and we give '2^32' for calculating // I didn't check this error on a new version of gcc part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing); } result += part; if( i < matparser.stack.size()-1 ) result += " "; } SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,result.c_str()); } }; #endif