www.pudn.com > 3.rar > manager.h, change:2004-03-23,size:1578b


//-------------------------------------------------------------------
//  file name: manager.h
// 
//    - header file for the manager class
//    - see the .cpp file for more details
//
//-------------------------------------------------------------------


#ifndef __MANAGER_H
#define __MANAGER_H


#include <omnetpp.h>
#include "globaldef.h"


/** manager simple module class. It is the central module that coordinates the message 
 * exchange between the sensor nodes. it is responsible for:
 *- storing position information for all the nodes
 *- managing the communication between the nodes
 *- creating and destroying the links between the nodes 
 * function of the mobility and the transmission range
 */
class manager : public cSimpleModule
{

	/** omnet++ specific code */
	Module_Class_Members(manager,cSimpleModule,16384);
	
	/** initialization function */
	void initialize();

	/** main loop function */
	void activity();

	// template specific functions
	
	/** Updates the signal strength. It performs the following functions:
	 *- convert the old rwp into a new one and update it everywhere
	 *- cancel any connect/disconnect messages of his node and delete all 
	 * the connections the node has
	 *- compute the new ones according to the new rwp
	 */
	void updateSignalStrength(cMessage *msg);
	
	/** User defined function.
	 *- computes the transmission range out of the signal strength
	 */
	int distance(int sstrength);
	 	
	// failures & maps stuff

	// variables
	/** connection matrix */
	bool cm[NNODES][NNODES];
};


Define_Module( manager );


#endif