MassMobility.h

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 <BaseMobility.h>
00027 
00028 
00037 class  MassMobility : public BaseMobility
00038 {
00039   protected:
00040     // config (see NED file for explanation)
00041     cPar *changeInterval;
00042     cPar *changeAngleBy;
00043 
00044     // current state
00045     double currentSpeed;   
00046     double currentAngle;   
00047     Coord step;            
00048 
00049     Coord targetPos;
00050 
00051   public:
00057     enum MassMobilityMsgKinds {
00058   MK_CHANGE_DIR = BaseMobility::LAST_BASE_MOBILITY_KIND,
00059   LAST_MASS_MOBILITY_KIND
00060     };
00061 
00062     //Module_Class_Members( MassMobility, BaseMobility, 0 );
00063 
00065     virtual void initialize(int);
00066 
00067    protected:
00069     virtual void handleSelfMsg(cMessage *msg);
00070 
00072     virtual void makeMove();
00073 
00074     virtual void fixIfHostGetsOutside();
00075 };
00076 
00077 #endif