Free Electron
xRecordView.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 __datatool_test_xRecordView_h__
8 #define __datatool_test_xRecordView_h__
9 
10 
11 using namespace fe;
12 using namespace fe::ext;
13 
14 class MyRecordView: public RecordView
15 {
16  private:
17  class Print;
18 
19  public:
20  Functor<F32> myF32;
21  Functor<I32> myI32;
22  Functor< sp<Component> > myMethod;
23 
24  MyRecordView(void) { setName("MyRecordView"); }
25 virtual void addFunctors(void)
26  {
27  add(myF32, "myF32");
28  add(myI32, "myI32");
29  add(myMethod, "myMethod");
30  }
31 virtual void initializeRecord(void)
32  {
33  myF32()= 4.5f;
34  myI32()= -3;
35  myMethod()=Library::create<MyRecordView::Print>(
36  "MyRecordView::Print");
37  }
38 };
39 
40 class MyRecordView::Print: public HandlerI
41 {
42  public:
43  void handle(Record& rRecord)
44  {
45  m_myRecordView.bind(rRecord);
46  feLog("MyRecordView::Print::handle myF32=%.6G myI32=%d\n",
47  m_myRecordView.myF32(),
48  m_myRecordView.myI32());
49  m_myRecordView.bind(Record());
50  };
51 
52  MyRecordView m_myRecordView;
53 };
54 
55 class MyDerivedView: public MyRecordView
56 {
57  public:
58  Functor<F32> moreF32;
59 
60  MyDerivedView(void) { setName("MyDerivedView"); }
61 virtual void addFunctors(void)
62  {
63  MyRecordView::addFunctors();
64 
65  add(moreF32,"moreF32");
66  }
67 virtual void initializeRecord(void)
68  {
69  MyRecordView::initializeRecord();
70 
71  myF32()=7.8f;
72  moreF32()=9.1f;
73  }
74 };
75 
76 #endif // __datatool_test_xRecordView_h__
Definition: SurfaceAccessibleAbc.cc:19
kernel
Definition: namespace.dox:3
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Bindable collection of accessor Functors.
Definition: RecordView.h:106
Reference to an instance of a Layout.
Definition: RecordSB.h:35