Example #1
0
void Parser::makeConnection(Graph *_g,std::string _input, std::string _output)
{
	Slot *in = Utilities::findSlot(_g, _input);
	Slot *out = Utilities::findSlot(_g, _output);
	if(in->getName() != "empty" && out->getName() != "empty")
	{
		in->linkToSlot(out);
		return;
	}
	std::cout<<"something went wrong\n";

}
Example #2
0
void XMLExporter::writeSlots(const Node *_n, const char *_inputkey, const char *_outputkey)
{
	int rc;
	for(Node::iterator i = _n->begin(); i<_n->end(); i++)
	{
		std::cout<<"in writing node"<<'\n';
		std::cout<<(*i)->getName()<<'\n';
		if((*i)->isInput())
		{
			rc = xmlTextWriterStartElement(m_writer, BAD_CAST _inputkey);
			writeSlotAttributes((*i)->getName(), (*i)->getVar());
			std::cout<<(*i)->isOverwritten()<<'\n';

			if ((*i)->isOverwritten())
			{
				Slot *out = (*i)->getLink();
				/*
				if(out->getParent()->getType() == nodeType::CONSTANT)
				{
					std::cout<<"writing constant node"<<'\n';
					Slot *out = (*i)->getLink();

					ConstantMap::const_iterator it;
					for(it = m_map->begin(); it != m_map->end(); it++)
					{
						std::cout<<it->first->getName()<<'\n';
						std::cout<<it->first<<'\n';
						std::cout<<out->getParent()->getName()<<'\n';
						std::cout<<out->getParent()<<'\n';
					}
					it = m_map->find(out->getParent());
					if(it != m_map->end())
					{
						std::cout<<"inside source element\n";
						writeSourceElement(
								out->getParent()->getName(),
								out->getParent()->getID(),
								out->getName(),
								it->second.c_str());
					}
				}
				*/
				writeSourceElement(
						out->getParent()->getName(),
						out->getParent()->getID(),
						out->getName());
			}
			rc = xmlTextWriterEndElement(m_writer);
		}
		else
		{
			rc = xmlTextWriterStartElement(m_writer, BAD_CAST _outputkey);
			writeSlotAttributes((*i)->getName(),(*i)->getVar());

			if ((*i)->isOverwritten())
			{
				Slot *out = (*i)->getLink();
				writeSourceElement(
						out->getParent()->getName(),
						out->getParent()->getID(), 
						out->getName());
			}
			rc = xmlTextWriterEndElement(m_writer);
		}
	}
}