void  MTConnectStreamsParser::DumpData(DataDictionary data)
{
	for(DataDictionary::iterator it = data.begin(); it!=data.end(); it++)
	{
		AtlTrace("%s = %s\n", (*it).first.c_str(), (*it).second.c_str());
	}
}
// Replace into data with newer from data
static DataDictionary  Merge(DataDictionary &into, DataDictionary &from)
{
	DataDictionary newdata = into;
	for(DataDictionary::iterator it=from.begin(); it!=from.end(); it++)
	{
		into[(*it).first]=(*it).second;
	}
	return newdata;
}
std::string  MTConnectStreamsParser::CreateHtmlTable(DataDictionary data)
{
	std::string updatetable;
	std::string style;

	updatetable += "<TABLE>\n";
	updatetable +=   "<TR>";
	std::string skip( "estop,controllermode,PartCountActual,avail,PartCountBad,power,probed,ProbeNumber,probe,path_feedratefrt" );
	for(DataDictionary::iterator it = data.begin(); it!=data.end(); it++)
	{
		if(skip.find((*it).first) != std::string::npos)
			continue;
		updatetable +=   "<TH> " + (*it).first    + "</TH> ";
	}
	updatetable +=   "</TR>\n";
	updatetable +=   "<TR>\n";
	for(DataDictionary::iterator it = data.begin(); it!=data.end(); it++)
	{
		style.clear();
		if(skip.find((*it).first) != std::string::npos)
			continue;
		if((*it).first == "Outtol")
		{

		}
		if((*it).first == "execution")
		{	
			if((*it).second == "READY")  
				style =   "style=\"background-color:lightblue;\"";
			if((*it).second == "ACTIVE")  
				style =    "style=\"background-color:lightgreen;\"";
		}

		updatetable +=   "<TD " + style + "> "+ (*it).second + "</TD>" ;
	}
	updatetable +=   "</TR>\n";

	updatetable += "</TABLE>\n";
	return updatetable;
}