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

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

The cstring experiment failed. Heading back to std::strings.

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