PassedMessage.h

00001 /* -*- mode:c++ -*- */
00002 
00003 #ifndef PASSED_MESSAGE_H
00004 #define PASSED_MESSAGE_H
00005 
00006 #include <string>
00007 #include <omnetpp.h>
00008 #include "ImNotifiable.h"
00009 
00010 class PassedMessage : public BBItem {
00011     BBITEM_METAINFO(BBItem);
00012  public:
00013     enum gates_t {
00014         UPPER_DATA,
00015   UPPER_CONTROL,
00016   LOWER_DATA,
00017   LOWER_CONTROL
00018     };
00019 
00020     enum direction_t {
00021         INCOMING,
00022         OUTGOING
00023     };
00024     
00025  public:
00026     static const char *gateToString(gates_t g) {
00027         const char *s;
00028         switch(g) {
00029         case UPPER_DATA: s = "UPPER_DATA"; break;
00030         case UPPER_CONTROL: s = "UPPER_CONTROL"; break;
00031         case LOWER_DATA: s = "LOWER_DATA"; break;
00032         case LOWER_CONTROL: s = "LOWER_CONTROL"; break;
00033         default:
00034             opp_error("PassedMessage::gateToString: got invalid value");
00035             s = 0;
00036             break;
00037         }
00038         return s;
00039     }
00040     
00041  public:
00042     // meta information 
00043     int fromModule;
00044     gates_t gateType;
00045     direction_t direction;
00046 
00047     // message information
00048     int kind;
00049     const char* name;
00050 };
00051 
00052 #endif
00053