shawn::NodeMovement Class Reference

Abstract interface for node mobility implementations. More...

#include <node_movement.h>

Inheritance diagram for shawn::NodeMovement:

Inheritance graph
[legend]
Collaboration diagram for shawn::NodeMovement:

Collaboration graph
[legend]

List of all members.

Public Member Functions

construction / destruction
 NodeMovement ()
virtual ~NodeMovement ()
virtual void init (Node &)=0 throw ()
virtual void init_from (Node &, NodeMovement &)=0 throw ()
node positioning
virtual bool set_position (const Vec &)=0 throw ()
virtual Vec position (void) const =0 throw ()
virtual Vec velocity (void) const =0 throw ()
misc access
virtual std::string name (void) const =0 throw ()
virtual int simulation_round (void) const throw ()
virtual double current_time (void) const throw ()
virtual const Worldworld (void) const throw ()
virtual Worldworld_w (void) throw ()
virtual Nodenode_w (void) throw ()
virtual const Nodenode (void) throw ()

Protected Member Functions

virtual void set_node (Node &) throw ()
virtual void movement_initial_boxes () throw ()
virtual void movement_update_boxes () throw ()
virtual void observers_added (MovementObserver &obs) throw ()
virtual void boxes_changed ()=0 throw ()


Detailed Description

Abstract interface for node mobility implementations.

A NodeMovement that supports only a single Node at once should probably derive from SingleNodeMovement , which provides a few utility methods for easier implementation.


Constructor & Destructor Documentation

shawn::NodeMovement::NodeMovement (  ) 

virtual shawn::NodeMovement::~NodeMovement (  )  [virtual]


Member Function Documentation

virtual void shawn::NodeMovement::init ( Node  )  throw () [pure virtual]

Called from Node when added there!

Should call set_node() and obtain_initial_boxes()

Implemented in shawn::JumpMovement, shawn::LinearMovement, shawn::NoMovement, and shawn::SimpleMovement.

virtual void shawn::NodeMovement::init_from ( Node ,
NodeMovement  
) throw () [pure virtual]

virtual bool shawn::NodeMovement::set_position ( const Vec  )  throw () [pure virtual]

sets the current position of the given node. There is no need for a NodeMovement to actually place the Node there, as it may be the single authority about node positions.

Returns:
whether the NodeMovement accepted the call, ie, a subsequent call to position() will return the set position.

Implemented in shawn::JumpMovement, shawn::LinearMovement, shawn::NoMovement, and shawn::SimpleMovement.

virtual Vec shawn::NodeMovement::position ( void   )  const throw () [pure virtual]

returns the current position of the node.

Implemented in shawn::JumpMovement, shawn::LinearMovement, shawn::NoMovement, and shawn::SimpleMovement.

virtual Vec shawn::NodeMovement::velocity ( void   )  const throw () [pure virtual]

returns the current velocity vector of the node, ie, the derivate of the position function.

Therefore,

  velocity().euclidean_norm()
gives the current speed, and
  velocity() / velocity().euclidean_norm()
gives the direction, if velocity() is not (0,0,0).

Implemented in shawn::JumpMovement, shawn::LinearMovement, shawn::NoMovement, and shawn::SimpleMovement.

virtual std::string shawn::NodeMovement::name ( void   )  const throw () [pure virtual]

Returns:
an identifying string

Implemented in shawn::JumpMovement, shawn::LinearMovement, shawn::NoMovement, and shawn::SimpleMovement.

virtual int shawn::NodeMovement::simulation_round ( void   )  const throw () [virtual]

Returns:
the current simulation round

virtual double shawn::NodeMovement::current_time ( void   )  const throw () [virtual]

Returns:
the current clock

virtual const World& shawn::NodeMovement::world ( void   )  const throw () [virtual]

Returns:
the World

virtual World& shawn::NodeMovement::world_w ( void   )  throw () [virtual]

Returns:
the World, writable

virtual Node& shawn::NodeMovement::node_w ( void   )  throw () [virtual]

virtual const Node& shawn::NodeMovement::node ( void   )  throw () [virtual]

virtual void shawn::NodeMovement::set_node ( Node  )  throw () [protected, virtual]

virtual void shawn::NodeMovement::movement_initial_boxes (  )  throw () [protected, virtual]

virtual void shawn::NodeMovement::movement_update_boxes (  )  throw () [protected, virtual]

virtual void shawn::NodeMovement::observers_added ( MovementObserver obs  )  throw () [protected, virtual]

virtual void shawn::NodeMovement::boxes_changed (  )  throw () [protected, pure virtual]


The documentation for this class was generated from the following file:

Generated on Sun Feb 5 00:01:06 2012 for Shawn by  doxygen 1.5.6