1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-09-20 05:25:37 +01:00

Compiled function: access to source code

This commit is contained in:
Antonin Portelli 2014-09-29 15:10:38 +01:00
parent bbeaec9ed3
commit bf3fe8bd13
4 changed files with 19 additions and 3 deletions

View File

@ -40,8 +40,14 @@ CompiledDoubleFunction::CompiledDoubleFunction(const unsigned nArg,
}
// access //////////////////////////////////////////////////////////////////////
string CompiledDoubleFunction::getCode(void)
{
return code_;
}
void CompiledDoubleFunction::setCode(const string &code)
{
code_ = code;
interpreter_.reset(new MathInterpreter(code));
context_.reset(new RunContext);
varAddress_.reset(new std::vector<unsigned int>);

View File

@ -38,6 +38,7 @@ public:
// destructor
virtual ~CompiledDoubleFunction(void) = default;
// access
std::string getCode(void);
void setCode(const std::string &code);
// function call
using DoubleFunction::operator();
@ -49,6 +50,7 @@ private:
// compile
void compile(void) const;
private:
std::string code_;
std::shared_ptr<MathInterpreter> interpreter_;
std::shared_ptr<RunContext> context_;
std::shared_ptr<std::vector<unsigned int>> varAddress_;

View File

@ -42,9 +42,15 @@ CompiledDoubleModel::CompiledDoubleModel(const unsigned nArg,
}
// access //////////////////////////////////////////////////////////////////////
string CompiledDoubleModel::getCode(void)
{
return code_;
}
void CompiledDoubleModel::setCode(const std::string &code)
{
interpreter_.reset(new MathInterpreter(code));
code_ = code;
interpreter_.reset(new MathInterpreter(code_));
context_.reset(new RunContext);
varAddress_.reset(new std::vector<unsigned int>);
parAddress_.reset(new std::vector<unsigned int>);

View File

@ -39,6 +39,7 @@ public:
// destructor
virtual ~CompiledDoubleModel(void) = default;
// access
std::string getCode(void);
void setCode(const std::string &code);
// function call
using DoubleModel::operator();
@ -50,6 +51,7 @@ private:
// compile
void compile(void) const;
private:
std::string code_;
std::shared_ptr<MathInterpreter> interpreter_;
std::shared_ptr<RunContext> context_;
std::shared_ptr<std::vector<unsigned int>> varAddress_, parAddress_;