void Component::setConnection(const GarbledCircuit_BON::GarbledCircuit& gc) { //internal? std::set<InternalWire> iw = gc->getInternalWire(); for(auto iwIt=iw.begin(); iwIt!=iw.end(); iwIt++) { std::string srcPort = (*iwIt)->getSourcePortIndex(); std::string destPort = (*iwIt)->getDestinationPortIndex(); ConnectionRef srcCCR = (*iwIt)->getSrc(); ConnectionRef destCCR = (*iwIt)->getDst(); CodeGeneratorNameSpace::Connection conn(srcCCR->getComponent(srcPort), destCCR->getComponent(destPort)); conn.setDescription((*iwIt)->getDescription()); currentJC.insert(conn); } }
void Component::setInputOutput(const GarbledCircuit_BON::GarbledCircuit& gc) { //generator? std::set<DefineInOutPut> gtc = gc->getDefineInOutPut(); for(auto gtcIt=gtc.begin(); gtcIt!=gtc.end(); gtcIt++) { std::string srcPort = (*gtcIt)->getSourcePortIndex(); std::string destPort = (*gtcIt)->getDestinationPortIndex(); GarbledCircuit_BON::InOutPut cd = (*gtcIt)->getSrc(); ConnectionRef ccr = (*gtcIt)->getDst(); std::string inputname = cd->getObjectMeta().name(); if("Input" == inputname) { CodeGeneratorNameSpace::InputConnection ic(((GarbledCircuit_BON::Input)cd)->getPortStartIndex(), srcPort, ccr->getComponent(destPort)); ic.setDescription((*gtcIt)->getDescription()); currentJC.insert(ic); } //output else { CodeGeneratorNameSpace::OutputConnection ic(((GarbledCircuit_BON::Output)cd)->getPortStartIndex(), srcPort, ccr->getComponent(destPort)); ic.setDescription((*gtcIt)->getDescription()); currentJC.insert(ic); } } }