Rework of memory handling in Evaluation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-07-27 17:59:42 +02:00
parent 268f6b59fb
commit ccc6e297f2
32 changed files with 496 additions and 461 deletions

View File

@@ -5,22 +5,26 @@
#include <map>
#include <vector>
#include "../EvalValues/EvalValue.hpp"
#include "../EvalValuePointer.hpp"
using namespace Porygon::Binder;
namespace Porygon::Evaluation {
class EvaluationScope {
map<Utilities::HashedString, shared_ptr<const EvalValue>> *_scriptScope;
map<uint64_t, shared_ptr<const EvalValue>> _localScope;
map<Utilities::HashedString, EvalValuePointer> *_scriptScope;
map<uint64_t, EvalValuePointer> _localScope;
public:
explicit EvaluationScope(map<Utilities::HashedString, shared_ptr<const EvalValue>> *scriptVariables);
explicit EvaluationScope(map<Utilities::HashedString, EvalValuePointer> *scriptVariables);
~EvaluationScope() = default;
~EvaluationScope(){
_localScope.clear();
};
void CreateVariable(const BoundVariableKey *key, const shared_ptr<const EvalValue>&value);
void CreateVariable(const BoundVariableKey *key, EvalValuePointer value);
void SetVariable(const BoundVariableKey *key, const shared_ptr<const EvalValue> &value);
void SetVariable(const BoundVariableKey *key, EvalValuePointer value);
shared_ptr<const EvalValue> GetVariable(const BoundVariableKey *key);
EvalValuePointer GetVariable(const BoundVariableKey *key);
};
}