Changeset 530

Show
Ignore:
Timestamp:
01/04/10 15:14:16 (14 years ago)
Author:
bhilburn
Message:

Redefining the cognitive engine class to reflect new class hierarchy.
From this point forward, the code will not compile until the task is
complete.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/include/vtcross/cognitive_engine.h

    r518 r530  
    2727/*! \brief Cognitive Engine class declaration. 
    2828 * 
    29  * All public functions are inherited from parent classes.  Please see parent 
    30  * class definitions for function documentation. 
     29 * This is the declaration for the default cognitive engine class.  Note that 
     30 * most of the below functions are implemented in CognitiveEngine.cpp - however, 
     31 * the functionality is very non-specific. 
     32 * 
     33 * Each of the 'Perform*' functions are left un-implemented, for the most part. 
     34 * 
     35 * The purpose of this class is to act as a non-abstract parent class. 
     36 * Cognitive Engines should be built by publically inherting from this class, 
     37 * and overloading the 'Perform*' functions - thus creating new and specific 
     38 * cognitive engine functionality, without the need to rewrite or copy/paste the 
     39 * rest of the code. 
     40 * 
     41 * Note, however, that all functions are virtual.  Any function may be 
     42 * overloaded by the child class, if desired. 
    3143 */ 
    3244class CognitiveEngine : public Engine 
     
    4759                const bool SML); 
    4860         
    49         void SendComponentType(); 
    50         void ConnectToRemoteComponent(const char* serverName, \ 
     61        virtual void SendComponentType(); 
     62        virtual void ConnectToRemoteComponent(const char* serverName, \ 
    5163                const char* serverPort, const bool SML); 
    52         void WaitForSignal(); 
    53         void Shutdown(); 
    54         void Reset(); 
    55         void RegisterComponent(); 
    56         void DeregisterComponent(); 
     64        virtual void WaitForSignal(); 
     65        virtual void Shutdown(); 
     66        virtual void Reset(); 
     67        virtual void RegisterComponent(); 
     68        virtual void DeregisterComponent(); 
    5769 
    58         void RegisterServices(); 
    59         void DeregisterServices(); 
     70        virtual void RegisterServices(); 
     71        virtual void DeregisterServices(); 
    6072 
    61     private: 
    6273        /*! \brief Receive radio XML configuration. 
    6374         *  
     
    6576         * (the CE will not always be local to the radio). This gets passed 
    6677         * through either the Shell or the SML. */ 
    67         void ReceiveRadioConfiguration(); 
     78        virtual void ReceiveRadioConfiguration(); 
    6879 
    6980        /*! \brief Receive an 'experience' report from the radio. 
     
    7283         * for a CE just starting up so that it has a moving start regarding 
    7384         * parameter optimization. */ 
    74         void ReceiveExperience(); 
     85        virtual void ReceiveExperience(); 
    7586 
    7687        /*! \brief Request that the CE optimize a set of parameters.  
     
    7990         * observables and possibly a service if the SML component is present 
    8091         * and active. */ 
    81         Parameter *GetSolution(Observable *observables, \ 
     92        virtual Parameter *GetSolution(Observable *observables, \ 
    8293                Parameter *currentParameters); 
    83         Parameter *GetSolution(Observable *observables, \ 
     94        virtual Parameter *GetSolution(Observable *observables, \ 
    8495                Parameter *currentParameters, std::string service); 
    8596 
     
    94105         * more accurate performance statistics.  
    95106         */ 
    96         void ReceiveFeedback(Observable *observables,Parameter *parameters); 
    97         void ReceiveFeedback(Observable *observables, Parameter *parameters, \ 
     107        virtual void ReceiveFeedback(Observable *observables,Parameter *parameters); 
     108        virtual void ReceiveFeedback(Observable *observables, Parameter *parameters, \ 
    98109                std::string service); 
    99110 
     
    107118         * may build the chromosome structure. 
    108119         */ 
    109         void BuildCognitiveEngine(); 
     120        virtual void BuildCognitiveEngine(); 
    110121 
     122        /*! \brief Each of these functions responds to a specific command. 
     123         * 
     124         * These functions are left principally un-implemented. It is the duty 
     125         * of child classes to implement these functions, as they define the 
     126         * cognitive engine's functionality. 
     127         */ 
     128        virtual void PerformUpdatePerformance(); 
     129        virtual void PerformRequestOptimizationService(); 
     130        virtual void PerformRequestOptimization(); 
     131        virtual void PerformQueryComponentType(); 
     132        virtual void PerformConnectSML(); 
     133        virtual void PerformDisconnectSML(); 
     134        virtual void PerformResetEngineCognitive(); 
     135        virtual void PerformShutdownEngineCognitive(); 
     136  
    111137        /*! \brief Keept track of what this CE is connected to.  
    112138         * 
     
    118144        bool SML_present; 
    119145        int32_t commandSocketFD; 
    120          
     146        
    121147        // TODO Need a description for these fields.  Are these radio utilites, 
    122148        // parameters, and observables global to the whole system?