Esempio n. 1
0
extern "C" void init_routing( shawn::SimulationController& sc )
{
	// Create two keepers in the simulation controller 
    // one for the factories ... 
	sc.add_keeper( new routing::RoutingFactoryKeeper );
	// ... and one for the created routing protocol instances
	sc.add_keeper( new routing::RoutingKeeper );
	sc.simulation_task_keeper_w().add( new routing::RoutingTask );

	routing::RoutingFactoryKeeper& rfk = routing::routing_factory_keeper_w(sc);

	// Initialize the routing algorithms
	
	// Distributed Tree
	{
		routing::tree::TreeRoutingProcessorFactory::register_factory(sc);
		rfk.add( new routing::tree::TreeRoutingFactory );
		// Tree knowledge injection
		sc.simulation_task_keeper_w().add( new routing::tree::TreeCreationTask );
	}

	// Distributed Flood
	{
		routing::flood::FloodRoutingProcessorFactory::register_factory(sc);
		rfk.add( new routing::flood::FloodRoutingFactory );
	}

	// Distributed GeoRouting
	{
		routing::geo::GeoRoutingProcessorFactory::register_factory(sc);
		rfk.add( new routing::geo::GeoRoutingFactory );
		// Pre creates the neighborhood
		sc.simulation_task_keeper_w().add( new routing::geo::GeoNeighborhoodCreationTask );
	}

	// Centralized FloodRouting
	{
		rfk.add( new routing::flood::CentralizedFloodRoutingFactory );
	}

	// Centralized TreeRouting
	{
		rfk.add( new routing::tree::CentralizedTreeRoutingFactory );
		sc.simulation_task_keeper_w().add( new routing::tree::CentralizedTreeCreationTask ); 
	}

	// Simplified GeoRouting
	{
		routing::geo::SimplifiedGeoRoutingProcessorFactory::register_factory(sc);
		rfk.add( new routing::geo::SimplifiedGeoRoutingFactory );
		//// Pre creates the neighborhood
		//sc.simulation_task_keeper_w().add( new routing::geo::SimplifiedGeoNeighborhoodCreationTask );
	}
}
Esempio n. 2
0
extern "C" void init_reading( shawn::SimulationController& sc )
{
   // Keepers
    sc.add_keeper(new reading::ReadingKeeper());
    sc.add_keeper(new reading::SensorKeeper());

   // Sensors
    sc.keeper_by_name_w<reading::SensorKeeper>("SensorKeeper")->add( new reading::SimpleSensorDoubleFactory );
    sc.keeper_by_name_w<reading::SensorKeeper>("SensorKeeper")->add( new reading::SimpleSensorIntegerFactory );

   // Test
   reading::RandomDoubleTestProcessorFactory::register_factory(sc);
   sc.simulation_task_keeper_w().add( new reading::SimulationTaskReadingDoubleTestCreate );
}
Esempio n. 3
0
  void init_topology_node_gen( shawn::SimulationController& sc )
  {
     std::cout << "init_topology_node_gen" << std::endl; 
     NodeGeneratorKeeper* ng = new NodeGeneratorKeeper;
     sc.add_keeper( ng );

     ng->add( new DefaultNodeGenerator );
  }