- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Rtapi/RTAPIMessage.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include "RTAPIMessage.h"
    00015
    00017
    00018 using namespace Mers::Executives::DeductiveController::Rtapi;
    00019 using Mers::Utils::Lang::BaseModelObject;
    00020 using std::ostream;
    00021
    00023 // Construction/Destruction
    00025
    00026 RTAPIMessage::RTAPIMessage(RTAPIMessage::MessageType myMessageType)
    00027 : BaseModelObject(BaseModelObject::oRTAPIMessage)
    00028 {
    00029         messageType = myMessageType;
    00030 }
    00031
    00033
    00034
    00035 RTAPIMessage::RTAPIMessage(RTAPIMessage::MessageType myMessageType,
    00036                            unsigned int myVarUID, unsigned int myValUID)
    00037 : BaseModelObject(BaseModelObject::oRTAPIMessage)
    00038 {
    00039         messageType = myMessageType;
    00040         variableUID = myVarUID;
    00041         valueUID = myValUID;
    00042 }
    00043
    00045
    00046
    00047 RTAPIMessage::RTAPIMessage(RTAPIMessage const &other)
    00048 : BaseModelObject(other)
    00049 {
    00050         messageType = other.messageType;
    00051         variableUID = other.variableUID;
    00052         valueUID = other.valueUID;
    00053 }
    00054
    00056
    00057
    00058 RTAPIMessage::RTAPIMessage(RTAPIMessage const * other)
    00059 : BaseModelObject(*other)
    00060 {
    00061         messageType = other->messageType;
    00062         variableUID = other->variableUID;
    00063         valueUID = other->valueUID;
    00064 }
    00065
    00067
    00068
    00069 RTAPIMessage::~RTAPIMessage()
    00070 {
    00071
    00072 }
    00073
    00075
    00076
    00077 RTAPIMessage::MessageType RTAPIMessage::getMessageType()
    00078 {
    00079         return messageType;
    00080 }
    00081
    00083
    00084
    00085 unsigned int RTAPIMessage::getVariableUID()
    00086 {
    00087         return variableUID;
    00088 }
    00089
    00091
    00092
    00093 unsigned int RTAPIMessage::getValueUID()
    00094 {
    00095         return valueUID;
    00096 }
    00097
    00099
    00100
    00101 #ifndef EMBEDDED
    00102
    00103 void RTAPIMessage::print(ostream &out) const
    00104 {
    00105         switch(messageType){
    00106         case COMMAND:
    00107                 out << "Command Message (" << variableUID << " = " << valueUID << ")";
    00108                 break;
    00109         case OBSERVATION:
    00110                 out << "Observation Message (" << variableUID << " = " << valueUID << ")";
    00111                 break;
    00112         case GOAL:
    00113                 out << "Goal Message (" << variableUID << " = " << valueUID << ")";
    00114                 break;
    00115         case STATE_UPDATE:
    00116                 out << "State Update Message (" << variableUID << " = " << valueUID << ")";
    00117                 break;
    00118         case FIND_MODE_ESTIMATE:
    00119                 out << "Find Mode Estimate Request";
    00120                 break;
    00121         case ABORT_COMMAND:
    00122                 out << "Abort Command Request";
    00123                 break;
    00124         case REPORT_FULL_STATE:
    00125                 out << "Report Full State Request";
    00126                 break;
    00127         case MR_REQUEST:
    00128                 out << "Mode Reconfiguration Request";
    00129                 break;
    00130         case QUIT:
    00131                 out << "Quit Request";
    00132                 break;
    00133         case INITIALIZE_STATE:
    00134                 out << "Init Msg (" << variableUID << " = " << valueUID << ")";
    00135                 break;
    00136         default:
    00137                 out << "Unknown Message Type: " << (unsigned int) messageType << " with ("
    00138                         << variableUID << " = " << valueUID << ")";
    00139                 break;
    00140         }
    00141 }
    00142
    00143 #endif
    00144
    00146