Free Electron
ControlCenter.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_ControlCenter_h__
8 #define __intelligence_ControlCenter_h__
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 /**************************************************************************//**
15  @brief ControlCenter RecordView
16 
17  @ingroup intelligence
18 *//***************************************************************************/
19 class FE_DL_EXPORT ControlCenter: public Controlled, public Radio
20 {
21  public:
22  Functor<Record> viewpoint;
23  Functor<Record> purview;
24  Functor< sp<RecordGroup> > controlled;
25  Functor< sp<RecordGroup> > behaviors;
26  Functor< sp<Component> > selfSignaler;
27  Functor<I32> dominance;
28  Functor<Real> time;
29 
30  ControlCenter(void) { setName("ControlCenter"); }
31 virtual void addFunctors(void)
32  {
35 
36  add(viewpoint, FE_USE("ai:viewpoint"));
37  add(purview, FE_USE("ai:observation"));
38 
39  add(controlled, FE_SPEC("ai:controlled",
40  "RG under our control"));
41  add(behaviors, FE_SPEC("ai:behaviors",
42  "RG of behaviors"));
43  add(selfSignaler, FE_SPEC("ai:selfSignaler",
44  "sp<Component> signaled for behaving"));
45  add(dominance, FE_SPEC("ai:dominance",
46  "Magnitude of control"));
47  add(time, FE_USE("sim:time"));
48  }
49 virtual void initializeRecord(void)
50  {
53 
54  selfSignaler.attribute()->setSerialize(FALSE);
55 
56  controlled.attribute()->setCloneable(FALSE);
57  behaviors.attribute()->setCloneable(FALSE);
58  selfSignaler.attribute()->setCloneable(FALSE);
59  purview.attribute()->setCloneable(FALSE);
60 
61  identifier()="ControlCenter";
62 
63  controlled.createAndSetRecordGroup();
64  controlled()->setWeak(TRUE);
65 
66  behaviors.createAndSetRecordGroup();
67 
68  selfSignaler.createAndSetComponent("SignalerI");
69 
70  Observation observationRV;
71  observationRV.bind(scope());
72  purview()=observationRV.createRecord();
73  observationRV.observer()=record();
74 
75  Sphere sphereRV;
76  sphereRV.bind(scope());
77  observationRV.shape()=sphereRV.createRecord();
78 
79  sphereRV.radius()=2.0f;
80 
81  dominance()=0;
82  time()=0.0f;
83  }
84 };
85 
86 } /* namespace ext */
87 } /* namespace fe */
88 
89 #endif /* __intelligence_ControlCenter_h__ */
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: ControlCenter.h:49
Controlled RecordView.
Definition: Controlled.h:19
void bind(sp< Scope > &rspScope)
Associate with a Scope.
Definition: RecordView.h:319
ControlCenter RecordView.
Definition: ControlCenter.h:19
kernel
Definition: namespace.dox:3
Radio RecordView.
Definition: Radio.h:19
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: ControlCenter.h:31
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: Radio.h:38
Observation RecordView.
Definition: Observation.h:22
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: Controlled.h:37
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: Controlled.h:27
Record createRecord(void)
Create a Record using all the attributes.
Definition: RecordView.h:469
Sphere RecordView.
Definition: Sphere.h:28
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: Radio.h:28