ant_miner::ant_miner(int num, base_type base,struct method_coefs K ): layer_num(num),ph_min(K.ph_min),ph_max(K.ph_max),eva_coef(K.evap_c), alpha(K.alpha),beta(K.beta), ants_number(K.ants_number),covarage(K.covarage) { cout<<eva_coef<<endl; start = new simpleNode(new test_empty("start"),1,1); finish = new simpleNode (new test_empty("finish"),1,1); vector <list<simpleNode*> > nodes (layer_num); pre_node_type::iterator it; for (int i=0;i<layer_num;++i) { for (it = base[i].begin();it!=base[i].end();++it ) { cout<<(*it).first->toString()<<" "<<(*it).second.second<<" "<<(*it).second.first<<endl; nodes[i].push_back(new simpleNode((*it).first,(*it).second.second,(*it).second.first)); } } make_connections(nodes,finish); count_probability(); cout<<"done!!"<<endl; iteration(); }
FormStreamingImp::FormStreamingImp(const QString & video_device , QWidget *parent ) : QWidget(parent) { setupUi(this); current_webcam = new Webcam( video_device ); Q_ASSERT( current_webcam != NULL ); current_webcam->setControllerWidget(&WebcamController); enableButtons(false); RSW = new RealStreamWidget(frame_stream); webcam_frame = new QImage(640,480,QImage::Format_RGB888); Q_ASSERT( RSW != NULL); QHBoxLayout *ns = new QHBoxLayout; ns->addWidget(RSW); frame_stream->setLayout(ns); current_webcam->setDrawSurface( webcam_frame); tet = new QTimer(this);//easy way. make_connections(); webcam_opened = false; show_fps = false; safe_image_plugin = false; //Just for test purposes, True, go by copy/ref. False: go by pointer on_movie_record = false; #ifndef WITH_XVID_RECORD pb_movie->hide(); #endif }
int main ( int argc, char *argv[] ) { // turn on data flow tracing and memory dump after load CPUObject::debug |= CPUObject::trace | CPUObject::memload; // make sure we've been given an object file name if( argc != 2 ) { cerr << "Usage: " << argv[0] << " object-file-name\n\n"; exit( 1 ); } cout << hex; // change base for future printing try { make_connections(); run_simulation( argv[1] ); } catch( ArchLibError &err ) { cout << endl << "Simulation aborted - ArchLib runtime error" << endl << "Cause: " << err.what() << endl; return( 1 ); } return( 0 ); }
void dataset_t::work(mscomplex_ptr_t msc) { assign_max_facets<1>(*this,m_tcc->begin(1),m_tcc->end(1)); assign_max_facets<2>(*this,m_tcc->begin(2),m_tcc->end(2)); assign_pairs<0>(*this,m_tcc->begin(0),m_tcc->end(0)); assign_pairs<1>(*this,m_tcc->begin(1),m_tcc->end(1)); assign_pairs2<1>(*this,m_tcc->begin(1),m_tcc->end(1)); cellid_list_t ccells; collect_cps(*this,m_tcc->begin(),m_tcc->end(),back_inserter(ccells)); for(cellid_list_t::iterator b = ccells.begin(),e =ccells.end();b!=e; ++b) { if(cell_dim(*b) == 2) bfs_owner_extrema<DES>(*this,*b); if(cell_dim(*b) == 0) bfs_owner_extrema<ASC>(*this,*b); } make_connections(*msc,ccells,*this); }
static EMBX_ERROR create_port(EMBX_TransportHandle_t *tp, const EMBX_CHAR *portName, EMBX_LocalPortHandle_t **port) { EMBX_ERROR res; EMBX_INT freeSlot; EMBXLB_LocalPortHandle_t *phlb; EMBXLB_Transport_t *tplb; tplb = (EMBXLB_Transport_t *)tp->transport; res = find_free_port_table_entry(tplb, portName, &freeSlot); switch (res) { case EMBX_SUCCESS: { break; } /* EMBX_SUCCESS */ case EMBX_NOMEM: { /* * If we have got to this point then there is no fixed * transport limit to number of ports (this is checked * in the shell) so try and grow the port table. */ if(grow_port_table(tplb, &freeSlot) != EMBX_SUCCESS) return EMBX_NOMEM; break; } /* EMBX_NOMEM */ default: { return res; } } phlb = (EMBXLB_LocalPortHandle_t *)EMBX_OS_MemAlloc(sizeof(EMBXLB_LocalPortHandle_t)); if(phlb != 0) { memcpy(phlb, &_embxlb_localport_handle_template, sizeof(EMBXLB_LocalPortHandle_t)); tplb->portTable[freeSlot] = phlb; *port = &phlb->port; /* * The transportHandle,port name and state members of the local port base * structure are filled in by the framework. */ /* * Finally, make connections for any blocked connection requests waiting * for this new port name. */ make_connections(tplb, phlb, portName); return EMBX_SUCCESS; } return EMBX_NOMEM; }