Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cExpressionContext.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cExpressionContext_H
7 #define _INC_cExpressionContext_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../Scriptable/cScriptableInterface.h" // CSCRIPT_CLASS_DEF0
13 #include "../Thread/cThreadLocal.h"
14 
15 namespace GrayLib
16 {
18  {
23  protected:
25 
26  public:
27  virtual ~cExpressionContext();
28 
29  virtual bool isValidCheck() const noexcept // override
30  {
31  if (!COBJECT_IsValidCheck())
32  return false;
33  return IS_TYPE_OF(cExpressionContext, this);
34  }
35 
36  enum M_TYPE_
37  {
38 #define cExpressionFunc(a,b,c,d) M_##a,
39 #include "cExpressionFunc.tbl"
40 #undef cExpressionFunc
42  };
43 
44  CSCRIPT_CLASS_DEF0(ExpressionContext)
45  static cScriptableMethod sm_Methods[M_QTY + 1];
46  STDMETHOD(s_InvokeExec)(const cScriptableMethod* pFunc, const cVariant& vArgs, cVariant& vValRet);
47  };
48 
51  {
55 
56  friend class cSingleton<cExpressionContextMgr>;
58 
59  private:
60  cExpressionContext* m_pContextRoot;
61 
62  protected:
64 
65  protected:
68 
69  public:
70  cExpressionContext* get_ContextCurrent0() const noexcept;
71  void put_ContextCurrent(cExpressionContext* pContext);
72 
73  cExpressionContext* get_ContextRoot() const noexcept
74  {
75  // Get global/default/root context. for all threads.
76  return m_pContextRoot;
77  }
78  cExpressionContext* put_ContextRoot(cExpressionContext* pContextRoot);
79 
80  static cExpressionContext* GRAYCALL GetContextCurrent();
81  };
82 
83 };
84 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define IS_TYPE_OF(t, p)
Definition: PtrCast.h:23
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define COBJECT_IsValidCheck()
Definition: cObject.h:64
#define CSCRIPT_CLASS_DEF0(TYPE)
Definition: cScriptableInterface.h:271
Definition: cExpressionContext.h:51
cThreadLocalSysT< cExpressionContext * > m_Current
Current context for the current thread. does not delete.
Definition: cExpressionContext.h:63
Definition: cExpressionContext.h:18
M_TYPE_
Definition: cExpressionContext.h:37
@ M_QTY
Definition: cExpressionContext.h:41
virtual bool isValidCheck() const noexcept
< memory allocation and structure definitions are valid.
Definition: cExpressionContext.h:29
Definition: cScriptableInterface.h:97
Definition: cVariant.h:26
Definition: cObject.h:67
Definition: cSingleton.h:127
Definition: cThreadLocalSys.h:153
Definition: cMesh.h:22