root/vtcross/trunk/src/include/vtcross/components.h @ 170

Revision 170, 6.7 KB (checked in by bhilburn, 15 years ago)

Added at _ton_ of TODOs where documentation needs to be written.

Line 
1/* Virginia Tech Cognitive Radio Open Source Systems
2 * Virginia Tech, 2009
3 *
4 * LICENSE INFORMATION GOES HERE
5 */
6
7/* This header exports the declarations for all VT-CROSS radio components.  It
8 * contains two pure abstract base classes, Component and Engine; Engine derives
9 * from Component.  All functions contained within the abstract base classes are
10 * dynamically linked and pure, and all child non-abstract classes derive using
11 * private inheritence.  Class functions of the abstract base classes are public
12 * for two reasons: (1) To allow for public/protected inheritence in other
13 * implementations, (2) So that symbolic debuggers can navigate the call tree
14 * for typecasted objects of derivative classes.
15 */
16
17#ifndef COMPONENTS_H
18#define COMPONENTS_H
19
20
21#include <stdint.h>
22
23#include "containers.h"
24
25
26/* Component abstract base class that all component classes should inherit from,
27 * including cognitive and policy engines, and the service management layer.
28 * Defines only functions required by all component types.
29 */
30class Component
31{
32    public:
33        /* Asks the component at the passed socket FD for its component type
34         * string.
35         */
36        virtual void GetRemoteComponentType(int32_t socketFD) = 0;
37
38
39        /* Wait for a command signal containing task instructions.
40         */
41        virtual void WaitForSignal(int32_t socketFD) = 0;
42
43
44        /* Completely shutdown the radio and all operations.
45         */
46        virtual void Shutdown() = 0;
47
48
49        /* Reset the radio and reload all configuration files.
50         *
51         * TODO are we remembering experiences in CEs?
52         */
53        virtual void Reset() = 0;
54
55
56        /* Register or deregister a component with the primary radio shell.
57         */
58        virtual void RegisterComponent(int32_t socketFD) = 0;
59        virtual void DeregisterComponent(int32_t socketFD) = 0;
60};
61
62
63/* Engine abstract base class from which all engine component types should
64 * inherit (e.g. cognitive and policy engines). Inherits all functions from the
65 * ABC Component publically.
66 */
67class Engine : public Component
68{
69    public:
70        /* Register or deregister services that this engine provides with the
71         * service management layer.
72         */
73        virtual void RegisterServices(int32_t socketFD) = 0;
74        virtual void DeregisterServices(int32_t socketFD) = 0;
75};
76
77
78/* Service Management Layer (SML) class declaration.  The functions listed here
79 * are required by the VTCROSS API for service-oriented VTCROSS radio
80 * architectures.
81 */
82class ServiceManagementLayer : public Component
83{
84    public:
85        ServiceManagementLayer();
86        ~ServiceManagementLayer();
87
88        void GetRemoteComponentType(int32_t socketFD);
89        void WaitForSignal(int32_t socketFD);
90        void Shutdown();
91        void Reset();
92        void RegisterComponent(int32_t socketFD);
93        void DeregisterComponent(int32_t socketFD);
94
95    private:
96        /* Receive the radio configuration settings from the shell and pass them
97         * on to another component.
98         */
99        void TransferRadioConfiguration();
100
101       
102        /* Receive information regarding a completed 'experience' and pass it on
103         * to the appropriate cognitive engine.
104         */
105        void TransferExperience();
106
107       
108        /* Listen for other components registering their available services with
109         * the SML. */
110        void ReceiveServices();
111
112
113        /* Change the active mission of the radio to a new one and adjust radio
114         * behavoir appropriately.
115         */
116        void SetActiveMission();
117
118
119        /* List all services provided to the radio by registered components.
120         */
121        void ListServices();
122
123
124        /* Load/Relead the XML configuration file.
125         */
126        void ReloadConfiguration();
127        void LoadConfiguration();
128};
129
130
131/* Policy Engine class declaration.  All public functions are inherited from
132 * parent classes.
133 */
134class PolicyEngine : public Engine
135{
136    public:
137        PolicyEngine();
138        ~PolicyEngine();
139
140        void GetRemoteComponentType(int32_t socketFD);
141        void WaitForSignal(int32_t socketFD);
142        void Shutdown();
143        void Reset();
144        void RegisterComponent(int32_t socketFD);
145        void DeregisterComponent(int32_t socketFD);
146
147        void RegisterServices(int32_t socketFD);
148        void DeregisterServices(int32_t socketFD);
149
150    private:
151        /* Parse and load/reload policies into the policy engine.
152         */
153        void LoadPolicies();
154        void ReloadPolicies();
155
156       
157        /* Return a decision made by the policy engine regarding a certain set
158         * of transmission parameters.
159         */
160        void SendPEDecision(int32_t socketFD, struct Parameter pList[], \
161                struct CE_Info *ce_info, int32_t decision_array[]);
162
163
164        /* Validate a set of transmission parameters received from the radio.
165         */
166        void ValidateParameters(struct Parameter pList[], \
167                struct CE_Info *ce_info, int decision_array[]);
168};
169
170
171/* Cognitive Engine class declaration.  All public functions are inherited from
172 * parent classes.
173 */
174class CognitiveEngine : public Engine
175{
176    public:
177        CognitiveEngine();
178        ~CognitiveEngine();
179
180        void GetRemoteComponentType(int32_t socketFD);
181        void WaitForSignal(int32_t socketFD);
182        void Shutdown();
183        void Reset();
184        void RegisterComponent(int32_t socketFD);
185        void DeregisterComponent(int32_t socketFD);
186
187        void RegisterServices(int32_t socketFD);
188        void DeregisterServices(int32_t socketFD);
189
190    private:
191        /* Receive the transmitted radio configuration from the radio itself
192         * (the CE will not always be local to the radio).
193         */
194        void ReceiveRadioConfiguration(int32_t socketFD);
195
196
197        /* Receive an 'experience' report from the radio.
198         */
199        void ReceiveExperience(int32_t socketFD);
200
201
202        /* Find the most optimal set of transmission parameters given certain
203         * observables and possibly a service if the SML component is present
204         * and active.
205         */
206        void GetSolution(Observable *observables);
207        void GetSolution(Observable *observables, std::string service);
208
209
210        /* Receive a feedback from the radio regarding the performance of a
211         * certain set of parameters, possibly associated with a service.
212         *
213         * TODO what is the difference between experiences and feedback,
214         * exactly? we should explain that explicitly here.
215         */
216        void ReceiveFeedback(Observable *observables,\
217                Parameter *parameters, Utility *utilities);
218        void ReceiveFeedback(Observable *observables, \
219                Parameter *parameters, std::string service);
220};
221
222#endif
Note: See TracBrowser for help on using the browser.