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

HostMove.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        HostMove.h
00003  *
00004  * author:      Andreas Koepke
00005  *
00006  * copyright:   (C) 2005 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 HOST_MOVE_H
00021 #define HOST_MOVE_H
00022 
00023 #include <string>
00024 #include "Coord.h"
00025 #include "Blackboard.h"
00026 #include <omnetpp.h>
00027 #include <cmath>
00028 
00038 class HostMove : public BBItem 
00039 {
00040     BBITEM_METAINFO(BBItem);
00041 
00042  public:
00044     Coord startPos;
00046     simtime_t startTime;
00048     Coord direction;
00050     double speed;
00051 
00052 public:
00053     void setDirection(const Coord& target) {
00054   double d = startPos.distance( target );
00055   direction.x = (target.x - startPos.x) / d;
00056   direction.y = (target.y - startPos.y) / d;
00057 
00058         //double d = sqrt(dir.x*dir.x + dir.y*dir.y);
00059         //direction.x = dir.x/d;
00060         //direction.y = dir.y/d;
00061     }
00062     
00063 public:
00064     
00065     std::string info() {
00066         std::ostringstream ost;
00067         ost << " HostMove "
00068             << " startPos.x: "<<startPos.x
00069             << " startPos.y: "<<startPos.y
00070             << " direction.x: "<< direction.x
00071             << " direction.y: "<< direction.y
00072             << " startTime: " << startTime
00073             << " speed: " << speed;
00074         return ost.str();
00075     }
00076 };
00077 
00078 #endif

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