00001 /* -*- mode:c++ -*- ********************************************************/ 00002 // 00003 // Author: Emin Ilker Cetinbas (niw3_at_yahoo_d0t_com) 00004 // Generalization: Andras Varga 00005 // Copyright (C) 2005 Emin Ilker Cetinbas, Andras Varga 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 // 00021 00022 00023 #ifndef MASS_MOBILITY_H 00024 #define MASS_MOBILITY_H 00025 00026 #include <omnetpp.h> 00027 00028 #include <BasicMobility.h> 00029 00030 00038 class MassMobility : public BasicMobility 00039 { 00040 protected: 00041 // config (see NED file for explanation) 00042 cPar *changeInterval; 00043 cPar *changeAngleBy; 00044 00045 // current state 00046 double currentSpeed; 00047 double currentAngle; 00048 Coord step; 00049 00050 Coord targetPos; 00051 00052 public: 00058 enum MassMobilityMsgKinds { 00059 MK_CHANGE_DIR = BasicMobility::LAST_BASIC, 00060 LAST_MASS 00061 }; 00062 00063 Module_Class_Members( MassMobility, BasicMobility, 0 ); 00064 00066 virtual void initialize(int); 00067 00068 protected: 00070 virtual void handleSelfMsg(cMessage *msg); 00071 00073 virtual void makeMove(); 00074 00075 virtual void fixIfHostGetsOutside(); 00076 }; 00077 00078 #endif