GemaLuaCoreLib
The GeMA Lua Core library
gmLuaValueInfo.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMALUA_VALUE_INFO_H_
25 #define _GEMALUA_VALUE_INFO_H_
26 
27 #include "gmLuaObject.h"
28 
29 class GmValueInfo;
30 #include <assert.h>
31 
33 class GML_API_EXPORT GmLuaValueInfo: public GmLuaObject
34 {
35 public:
36  GmLuaValueInfo(GmValueInfo* info, const GmLogCategory& logger, bool ownership = false);
37  virtual ~GmLuaValueInfo();
38 
39  // See comments on the base class
40  virtual const char* typeName() const { return "valueInfo"; }
41 
42  virtual QString toString() const;
43 
44  virtual void fillMetatable(lua_State* L, int index);
45 
47  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
48 
50  GmValueInfo* info() const { return _info; }
51 
53  bool ownership() const { return _ownsInfo; }
54 
56  void takeOwnership() { assert(_ownsInfo); _ownsInfo = false; }
57 
58 private:
59  int id (lua_State* L);
60  int description (lua_State* L);
61  int unit (lua_State* L);
62  int kind (lua_State* L);
63  int isNodeBased (lua_State* L);
64  int storageType (lua_State* L);
65  int dimType (lua_State* L);
66  int size (lua_State* L);
67  int nlin (lua_State* L);
68  int ncol (lua_State* L);
69  int isScalar (lua_State* L);
70  int defValue (lua_State* L);
71  int canStoreFunctions(lua_State* L);
72  int allocMode (lua_State* L);
73  int allocStrategy(lua_State* L);
74  int affectedNodes(lua_State* L);
75  int history (lua_State* L);
76  int setHistory (lua_State* L);
77  int ruleSet (lua_State* L);
78  int setRuleSet (lua_State* L);
79  int format (lua_State* L);
80  int setFormat (lua_State* L);
81  int constMap (lua_State* L);
82  int print (lua_State* L);
83 
85  bool _ownsInfo;
86 };
87 
88 #endif
Declaration of the GmLuaObject class.
bool _ownsInfo
Are we the owner of _info?
Definition: gmLuaValueInfo.h:85
void takeOwnership()
Takes the info ownership from the proxy object.
Definition: gmLuaValueInfo.h:56
A proxy class to export GmValueInfo methods to the Lua environment.
Definition: gmLuaValueInfo.h:33
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaValueInfo.h:40
bool ownership() const
Returns true if the info object is owned by the proxy object.
Definition: gmLuaValueInfo.h:53
virtual void fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmValueInfo object.
Definition: gmLuaValueInfo.h:47
void print(const GmMatrix &m, const GmLogCategory &logger, GmLogLevel level, int fieldWidth, char format, int precision)
GmValueInfo * _info
The wrapped value info object.
Definition: gmLuaValueInfo.h:84
virtual QString toString() const
Default method used by the __tostring metamethod to capture the result of tostring() over an object.
Definition: gmLuaObject.h:55
A proxy class to export object methods to the Lua environment.
Definition: gmLuaObject.h:35
GmValueInfo * info() const
Returns a pointer to the internal info object.
Definition: gmLuaValueInfo.h:50