ug4
lua_table_handle.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 G-CSC, Goethe University Frankfurt
3  * Author: Felix Salfelder
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef H__UG__LUA_TABLE_HANDLE__
34 #define H__UG__LUA_TABLE_HANDLE__
35 
36 #include <string>
37 #include <cstddef>
38 using std::size_t;
39 
40 typedef struct lua_State lua_State;
41 
42 namespace ug{
43 class Variant;
44 namespace impl{
45 struct LuaTableHandle_;
46 }
47 
49 class LuaTableHandle /* public SuitableBaseClass */ {
50 public:
51  LuaTableHandle() = delete;
54  explicit LuaTableHandle(lua_State* ref, int idx);
56 
57 public:
58  size_t size() const;
59  ug::Variant get(std::string const& key) const;
60  ug::Variant get(int const& key) const;
61 
64 
65 private:
67 };
68 
69 } // ug
70 
71 #endif // guard
Handle for a lua reference.
Definition: lua_table_handle.h:49
ug::Variant get(std::string const &key) const
Definition: lua_table_handle.cpp:212
LuaTableHandle & operator=(LuaTableHandle const &)
Definition: lua_table_handle.cpp:193
LuaTableHandle()=delete
impl::LuaTableHandle_ * _data
Definition: lua_table_handle.h:66
size_t size() const
Definition: lua_table_handle.cpp:206
~LuaTableHandle()
Definition: lua_table_handle.cpp:187
A variant can represent variables of different types.
Definition: variant.h:87
struct lua_State lua_State
Definition: lua_table_handle.h:40
the ug namespace
Definition: lua_table_handle.cpp:46