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 //////////////////////////////////////////////////////////////////////
|
||||
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>);
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
// destructor
|
||||
virtual ~CompiledDoubleFunction(void) = default;
|
||||
// access
|
||||
void setCode(const std::string &code);
|
||||
std::string getCode(void);
|
||||
void setCode(const std::string &code);
|
||||
// function call
|
||||
using DoubleFunction::operator();
|
||||
virtual double operator()(const double *arg) const;
|
||||
@ -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_;
|
||||
|
@ -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>);
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
// destructor
|
||||
virtual ~CompiledDoubleModel(void) = default;
|
||||
// access
|
||||
void setCode(const std::string &code);
|
||||
std::string getCode(void);
|
||||
void setCode(const std::string &code);
|
||||
// function call
|
||||
using DoubleModel::operator();
|
||||
virtual double operator()(const double *arg, const double *par) const;
|
||||
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user