Exemple #1
0
/***
	addBlock: Adds the current node in the queue of blocks
	current: Current node from cfg's nodes list
*/
void addBlock(xmlNode *current)
{
	char *id;

	id = getAttrStr(current, "id");

	if (start_block == NULL)
	{
		//puts("inicio entao\n");
		start_block = (tblock *) malloc(sizeof(tblock));
		start_block->next_block = NULL;
		strncpy(start_block->info_node.id, id, 5);
		start_block->info_node.clock_cycles = getAttrInt(current, "clock-cycles");
		start_block->class_node = getAttrChr(current, "class");
		start_block->info_node.energy = getAttrDbl(current, "energy");
		start_block->info_node.consumed_cycles = 0;
		start_block->info_node.consumed_energy = 0;
		start_block->timesexec = 0;
		start_block->node = createNode(current);
		end_block = start_block;
		//puts("fim entao\n");
	}
	else
	{
		puts("inicio senao\n");
		puts(id);
		tblock *new_block;

		new_block = (tblock *) malloc(sizeof(tblock));
		new_block->next_block = NULL;
		end_block->next_block = new_block;
		end_block = new_block;
		strncpy(new_block->info_node.id, id, 5);
		new_block->info_node.clock_cycles = getAttrInt(current, "clock-cycles");
		new_block->info_node.energy = getAttrDbl(current, "energy");
		new_block->info_node.consumed_cycles = 0;
		new_block->info_node.consumed_energy = 0;
		new_block->timesexec = 0;
		new_block->class_node = getAttrChr(current, "class");
		new_block->node = createNode(current);
		puts("fim senao\n");
	}

	free(id);
}
  void startND(const XMLCh* const uri, const XMLCh* const localnameXML, const XMLCh* const qname, const Attributes& attrs)
  {
    // WE SHOULD MOVE this into the Way::Nd::Process function
    // attribute ref
    int ref = getAttrInt(attrs,OSM::szREF);   
    RTreeWorld::TMapIDCoord::iterator i = world.node_id_coord.lower_bound(ref);
    if ((i != world.node_id_coord.end() ) && ( i->first == ref))
      {
	add_nd(i->first,i->second);
      }
    else
      {
	if (output_missing)
	  cerr << "MISSING: " << ref << endl;
      }    
  }