Free Electron
LuaBehavior.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __intelligence_LuaBehavior_h__
8 #define __intelligence_LuaBehavior_h__
9 
10 #include "lua/LuaI.h"
11 namespace fe
12 {
13 namespace ext
14 {
15 
16 /**************************************************************************//**
17  @brief Load a Lua script and run it when signaled
18 
19  @ingroup intelligence
20 
21  A behavior can get bound to a ControlCenter's self-signaler.
22  The signal is the ControlCenter record itself.
23 
24  A LuaBehavior is potentially created as an attribute of a general
25  Behavior, when it is deemed to be the appropriate pluggable component
26  by the Behavior configuration.
27 
28  As a RecordableI, a LuaBehavior can receive a Behavior in a bind.
29  From this, the LuaBehavior can derive pertinent configuration.
30 *//***************************************************************************/
31 class FE_DL_EXPORT LuaBehavior: virtual public HandlerI,
32  virtual public RecordableI
33 {
34  public:
35  LuaBehavior(void) {}
36 
37  //* as HandlerI
38 virtual void handle(Record& record);
39 
40  //* as RecordableI
41 virtual void bind(Record& record) { m_recorded=record; }
42 
43  private:
44 
45  WeakRecord m_recorded;
46  sp<LuaI> m_spLuaI;
47 
48  ControlCenter m_controlRV;
49  Behavior m_behaviorRV;
50 };
51 
52 } /* namespace ext */
53 } /* namespace fe */
54 
55 #endif /* __intelligence_LuaBehavior_h__ */
ControlCenter RecordView.
Definition: ControlCenter.h:19
kernel
Definition: namespace.dox:3
Behavior RecordView.
Definition: Behavior.h:19
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Generic binding to a serializable state.
Definition: RecordableI.h:20
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Load a Lua script and run it when signaled.
Definition: LuaBehavior.h:31
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17