Search Results
LazyTable.h
/*
* MoMEMta: a modular implementation of the Matrix Element Method
* Copyright (C) 2016 Universite catholique de Louvain (UCL), Belgium
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>
#include <string>
#include <momemta/ParameterSet.h>
#include <lua/utils.h>
namespace lua {
struct LazyTableField : public Lazy {
std::string table_name;
std::string key;
virtual momemta::any operator()() const override;
void ensure_created();
void set(const momemta::any& value);
LazyTableField(lua_State *L, const std::string& table_name, const std::string& key);
};
class LazyTable: public ParameterSet {
friend class ConfigurationReader;
public:
LazyTable(std::shared_ptr<lua_State> L, const std::string& name);
virtual LazyTable* clone() const override;
protected:
virtual void create(const std::string& name, const momemta::any& value) override;
virtual void setInternal(const std::string& name, Element& element, const momemta::any& value) override;
virtual bool lazy() const override;
virtual void freeze() override;
private:
std::shared_ptr<lua_State> m_lua_state;
};
}