mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 08:55:37 +00:00
Compiled function: access to source code
This commit is contained in:
parent
bbeaec9ed3
commit
bf3fe8bd13
@ -40,8 +40,14 @@ CompiledDoubleFunction::CompiledDoubleFunction(const unsigned nArg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// access //////////////////////////////////////////////////////////////////////
|
// access //////////////////////////////////////////////////////////////////////
|
||||||
|
string CompiledDoubleFunction::getCode(void)
|
||||||
|
{
|
||||||
|
return code_;
|
||||||
|
}
|
||||||
|
|
||||||
void CompiledDoubleFunction::setCode(const string &code)
|
void CompiledDoubleFunction::setCode(const string &code)
|
||||||
{
|
{
|
||||||
|
code_ = code;
|
||||||
interpreter_.reset(new MathInterpreter(code));
|
interpreter_.reset(new MathInterpreter(code));
|
||||||
context_.reset(new RunContext);
|
context_.reset(new RunContext);
|
||||||
varAddress_.reset(new std::vector<unsigned int>);
|
varAddress_.reset(new std::vector<unsigned int>);
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
// destructor
|
// destructor
|
||||||
virtual ~CompiledDoubleFunction(void) = default;
|
virtual ~CompiledDoubleFunction(void) = default;
|
||||||
// access
|
// access
|
||||||
|
std::string getCode(void);
|
||||||
void setCode(const std::string &code);
|
void setCode(const std::string &code);
|
||||||
// function call
|
// function call
|
||||||
using DoubleFunction::operator();
|
using DoubleFunction::operator();
|
||||||
@ -49,6 +50,7 @@ private:
|
|||||||
// compile
|
// compile
|
||||||
void compile(void) const;
|
void compile(void) const;
|
||||||
private:
|
private:
|
||||||
|
std::string code_;
|
||||||
std::shared_ptr<MathInterpreter> interpreter_;
|
std::shared_ptr<MathInterpreter> interpreter_;
|
||||||
std::shared_ptr<RunContext> context_;
|
std::shared_ptr<RunContext> context_;
|
||||||
std::shared_ptr<std::vector<unsigned int>> varAddress_;
|
std::shared_ptr<std::vector<unsigned int>> varAddress_;
|
||||||
|
@ -42,9 +42,15 @@ CompiledDoubleModel::CompiledDoubleModel(const unsigned nArg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// access //////////////////////////////////////////////////////////////////////
|
// access //////////////////////////////////////////////////////////////////////
|
||||||
|
string CompiledDoubleModel::getCode(void)
|
||||||
|
{
|
||||||
|
return code_;
|
||||||
|
}
|
||||||
|
|
||||||
void CompiledDoubleModel::setCode(const std::string &code)
|
void CompiledDoubleModel::setCode(const std::string &code)
|
||||||
{
|
{
|
||||||
interpreter_.reset(new MathInterpreter(code));
|
code_ = code;
|
||||||
|
interpreter_.reset(new MathInterpreter(code_));
|
||||||
context_.reset(new RunContext);
|
context_.reset(new RunContext);
|
||||||
varAddress_.reset(new std::vector<unsigned int>);
|
varAddress_.reset(new std::vector<unsigned int>);
|
||||||
parAddress_.reset(new std::vector<unsigned int>);
|
parAddress_.reset(new std::vector<unsigned int>);
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
// destructor
|
// destructor
|
||||||
virtual ~CompiledDoubleModel(void) = default;
|
virtual ~CompiledDoubleModel(void) = default;
|
||||||
// access
|
// access
|
||||||
|
std::string getCode(void);
|
||||||
void setCode(const std::string &code);
|
void setCode(const std::string &code);
|
||||||
// function call
|
// function call
|
||||||
using DoubleModel::operator();
|
using DoubleModel::operator();
|
||||||
@ -50,6 +51,7 @@ private:
|
|||||||
// compile
|
// compile
|
||||||
void compile(void) const;
|
void compile(void) const;
|
||||||
private:
|
private:
|
||||||
|
std::string code_;
|
||||||
std::shared_ptr<MathInterpreter> interpreter_;
|
std::shared_ptr<MathInterpreter> interpreter_;
|
||||||
std::shared_ptr<RunContext> context_;
|
std::shared_ptr<RunContext> context_;
|
||||||
std::shared_ptr<std::vector<unsigned int>> varAddress_, parAddress_;
|
std::shared_ptr<std::vector<unsigned int>> varAddress_, parAddress_;
|
||||||
|
Loading…
Reference in New Issue
Block a user