void ofxSyncServer::start() { ofxSyncConnection::pointer new_con(new ofxSyncConnection(io_service_)); acceptor_.async_accept( new_con->socket() ,boost::bind( &ofxSyncServer::handleAccept ,this ,new_con ,boost::asio::placeholders::error ) ); io_service_.run(); }
void ofxSyncServer::handleAccept(ofxSyncConnection::pointer pCon, const boost::system::error_code &rErr) { std::cout << "ofxSyncServer: handleAccept, new connection." << std::endl; if(!rErr) { pCon->start(); ofxSyncConnection::pointer new_con(new ofxSyncConnection(io_service_)); acceptor_.async_accept( new_con->socket() ,boost::bind( &ofxSyncServer::handleAccept ,this ,new_con ,boost::asio::placeholders::error ) ); } else { std::cout << rErr.message() << std::endl; } }
bool simulateTree(AstNode *nodep, const V3Number *loopValue, AstNode *dtypep, V3Number &outNum) { AstNode* clone = nodep->cloneTree(true); if (!clone) { nodep->v3fatalSrc("Failed to clone tree"); return false; } if (loopValue) { m_varValuep = new AstConst (nodep->fileline(), *loopValue); // Iteration requires a back, so put under temporary node AstBegin* tempp = new AstBegin (nodep->fileline(), "[EditWrapper]", clone); m_varModeReplace = true; tempp->stmtsp()->iterateAndNext(*this); m_varModeReplace = false; clone = tempp->stmtsp()->unlinkFrBackWithNext(); tempp->deleteTree(); tempp = NULL; pushDeletep(m_varValuep); m_varValuep = NULL; } SimulateVisitor simvis; simvis.mainParamEmulate(clone); if (!simvis.optimizable()) { UINFO(3, "Unable to simulate" << endl); if (debug()>=9) nodep->dumpTree(cout,"- _simtree: "); return false; } // Fetch the result V3Number* res = simvis.fetchNumberNull(clone); if (!res) { UINFO(3, "No number returned from simulation" << endl); return false; } // Patch up datatype if (dtypep) { AstConst new_con (clone->fileline(), *res); new_con.dtypeFrom(dtypep); outNum = new_con.num(); return true; } outNum = *res; return true; }