Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

RadioState.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        RadioState.h
00003  *
00004  * author:      Andreas Koepke
00005  *
00006  * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at
00007  *              Technische Universitaet Berlin, Germany.
00008  *
00009  *              This program is free software; you can redistribute it
00010  *              and/or modify it under the terms of the GNU General Public
00011  *              License as published by the Free Software Foundation; either
00012  *              version 2 of the License, or (at your option) any later
00013  *              version.
00014  *              For further information see file COPYING
00015  *              in the top level directory
00016  ***************************************************************************
00017  * part of:     framework implementation developed by tkn
00018  **************************************************************************/
00019 
00020 #ifndef RADIOSTATE_H
00021 #define RADIOSTATE_H
00022 
00023 #include <omnetpp.h>
00024 #include <Blackboard.h>
00025 #include <sstream>
00026 
00042 class  RadioState : public BBItem
00043 {
00044     BBITEM_METAINFO(BBItem);
00045     
00046  public:
00048     enum States
00049     {
00050         SLEEP,
00051         RECV,
00052         SEND,
00053         SWITCH_TO_SLEEP,
00054         SWITCH_TO_RECV,
00055         SWITCH_TO_SEND
00056     };
00057 
00058 protected:
00060     States state;
00061 
00062 public:
00063 
00065     States getState() const {
00066         return state;
00067     }
00068     
00070     void setState(States s) {
00071         state=s;
00072     }
00073 
00075     RadioState(States s=RECV) : BBItem(), state(s) {
00076     };
00077 
00079     std::string info() const {
00080         std::ostringstream ost;
00081         ost << " RadioState is ";
00082         switch(state) {
00083         case SLEEP:
00084             ost<<"SLEEP";
00085             break;
00086         case RECV:
00087             ost<<"RECV";
00088             break;
00089         case SEND:
00090             ost<<"SEND";
00091             break;
00092         case SWITCH_TO_SLEEP:
00093             ost<<"SWITCH_TO_SLEEP";
00094             break;
00095         case SWITCH_TO_RECV:
00096             ost<<"SWITCH_TO_RECV";
00097             break;
00098         case SWITCH_TO_SEND:
00099             ost<<"SWITCH_TO_SEND";
00100             break;
00101         default: ost << "???"; break;
00102         }
00103         return ost.str();
00104     }
00105 };
00106 
00107 #endif

Generated on Fri Jan 12 08:29:32 2007 for Mobility Framework by  doxygen 1.4.4