// ---------------------------------------------------------------------- shawn::Node* DefaultNodeGenerator:: generate_node( const shawn::Vec& pos ) throw( std::runtime_error ) { shawn::Node* v = allocate_node(); set_position(*v,pos); label_node(*v); add_processors(*v,proc_factories_); assert( simulation_controller_w().has_world() ); add_to_world(*v,simulation_controller_w().world_w()); return v; }
// ---------------------------------------------------------------------- void ExperimentControl:: flash_programs( std::string id, NodeIdVector nodes, IndicesVector indices, FlashProgramVector programs ) throw() { NodeIdVector response_nodes; StatusValueVector response_values; StatusMsgVector response_msgs; IndicesVector::iterator idx_it = indices.begin(); for ( NodeIdVector::iterator it = nodes.begin(); it != nodes.end(); ++it, ++idx_it ) { shawn::Node *node = simulation_controller_w().world_w().find_node_by_label_w( *it ); if ( node ) { TestbedServiceProcessor *proc = node->get_processor_of_type_w<TestbedServiceProcessor>(); if ( proc ) { proc->flash_program( programs.at( *idx_it ) ); response_values.push_back( 1 ); } else response_values.push_back( 0 ); } else response_values.push_back( -1 ); response_nodes.push_back( *it ); response_msgs.push_back( "" ); } controller().send_receive_status( id, response_nodes, response_values, response_msgs ); }