您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tp函数代码示例

51自学网 2021-06-03 08:55:57
  C++
这篇教程C++ tp函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tp函数的典型用法代码示例。如果您正苦于以下问题:C++ tp函数的具体用法?C++ tp怎么用?C++ tp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tp函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: remove_table

/** * /param[in] rUser user name * /return true = success, false = failure */ bool remove_table(const std::string& rUser){  fprintf(stderr, "removing table for user '%s'/n", rUser.c_str());    std::string tp(IncronTab::GetUserTablePath(rUser));   if (unlink(tp.c_str()) != 0 && errno != ENOENT) {    fprintf(stderr, "cannot remove table for user '%s': %s/n", rUser.c_str(), strerror(errno));    return false;  }    return true;}
开发者ID:wankdanker,项目名称:svn.aiken.cz,代码行数:17,


示例2: tp

void PlayerPlaylist::select(int id) {  std::stringstream ss;  ss << id;  Gtk::TreePath tp(ss.str());  //Gtk::TreeViewColumn *tvc;  //  m_TreeView.get_cursor(tp,tvc);  std::cout<<tp.to_string()<<std::endl;  //tp.next();  m_TreeView.set_cursor(tp);}
开发者ID:kompote,项目名称:musiKOS,代码行数:13,


示例3: while

    bool MultipleTermPositions::skipTo(int32_t target)    {        while (termPositionsQueue->top() && target > termPositionsQueue->top()->doc())        {            TermPositionsPtr tp(termPositionsQueue->top());            termPositionsQueue->pop();            if (tp->skipTo(target))                termPositionsQueue->add(tp);            else                tp->close();        }        return next();    }
开发者ID:breezylulu333,项目名称:LucenePlusPlus,代码行数:14,


示例4: tp

void PrettyPrinter::special_print(const Store* store,                                  std::ostream& outStream,                                  const std::string tableName,                                  const size_t& limit,                                  const size_t& start) {  ftprinter::FTPrinter tp(tableName, outStream);  tp.addColumn("#rowid", 6);  const size_t columns = store->columnCount();  // TODO: how about using limit=0 as parameter to print whole table instead of strange -1 for unsigned?  auto prepareLimit = (limit < (size_t) - 1) ? std::min(limit, store->size()) : store->size();  for (size_t column_index = 0; column_index < columns; ++column_index) {    // Auto adjusting widths means iterating over the table twice, but we use it for    // debugging purposes only, anyways, so we'll go with beauty of output here    auto name = store->nameOfColumn(column_index);    size_t width = std::accumulate(RangeIter(0),                                   RangeIter(prepareLimit),                                   // minimum width is 4                                   name.size() > 4 ? name.size() : 4,                                   [&](size_t max, const size_t row)->size_t {      size_t sz = generateValue(store, column_index, row).size();      return sz > max ? sz : max;    });    tp.addColumn(name, width);  }  tp.addColumn("$tid", 6);  tp.addColumn("$cidbeg", 6);  tp.addColumn("$cidend", 6);  if (limit < (size_t) - 1) {    outStream << "(showing first " << limit << " rows)" << std::endl;  }  if (tableName.size() > 0)    tp.printTableName();  tp.printHeader();  for (size_t row = start; row < store->size() && row < limit; ++row) {    tp << row;    for (size_t column = 0; column < columns; ++column) {      tp << generateValue(store, column, row);    }    writeTid(tp, store->_tidVector[row]);    writeCid(tp, store->_cidBeginVector[row]);    writeCid(tp, store->_cidEndVector[row]);  }  tp.printFooter();}
开发者ID:gekkonerd,项目名称:hyrise,代码行数:50,


示例5: tp

void SlippyMap::render(QPainter *p, const QRect &rect){    for (int x = 0; x <= m_tilesRect.width(); ++x)        for (int y = 0; y <= m_tilesRect.height(); ++y) {            QPoint tp(x + m_tilesRect.left(), y + m_tilesRect.top());            QRect box = tileRect(tp);            if (rect.intersects(box)) {                if (m_tilePixmaps.contains(tp))                    p->drawPixmap(box, m_tilePixmaps.value(tp));                else                    p->drawPixmap(box, m_emptyTile);            }        }}
开发者ID:caybro,项目名称:pedikree,代码行数:14,


示例6: tp

void MyApp::PaintScreen(sInt screen,sInt time){   time += screen*1234;  // set rendertarget  static sU32 colors[4] = { 0xff405060,0xffc04040,0xff40c040,0xff4040c0 };  sTargetPara tp(sST_CLEARALL,colors[screen&3],0,sGetScreenColorBuffer(screen),sGetScreenDepthBuffer(screen));  sSetTarget(tp);  // set camera  View.SetTargetCurrent();  View.SetZoom(1.0f);  View.Model.EulerXYZ(time*0.0011f,time*0.0013f,time*0.0015f);  View.Model.l.Init(0,0,0);  View.Camera.l.Init(0,0,-4);  View.Prepare();  // set material  sCBuffer<sSimpleMaterialEnvPara> cb;  cb.Data->Set(View,Env);  Mtrl->Set(&cb);  // draw  Geo->Draw();  // debug  sF32 avg = Timer.GetAverageDelta();  Painter->SetTarget();  Painter->Begin();  Painter->SetPrint(0,0xff000000,2);  Painter->SetPrint(0,~0,2);  Painter->PrintF(10,10,L"screen %d: %s",screen,ScreenNames[screen]);  if (screen)    Painter->PrintF(10,30,L"on %s",AdapterName);  else    Painter->PrintF(10,30,L"%5.2ffps %5.3fms",1000.0f/avg,avg);  Painter->End();  // resolve multisampling  sResolveTarget();}
开发者ID:Ambrevar,项目名称:fr_public,代码行数:49,


示例7: get_max_threads

/** * generates MC neutrons using available threads */Ellipsoid4d<t_real> TASReso::GenerateMC(std::size_t iNum, std::vector<t_vec>& vecNeutrons) const{	// use deferred version if threading is disabled	//if(!m_bEnableThreads)	//	return GenerateMC_deferred(iNum, vecNeutrons);	// number of iterations over random sample positions	std::size_t iIter = m_res.size();	if(vecNeutrons.size() != iNum*iIter)		vecNeutrons.resize(iNum*iIter);	Ellipsoid4d<t_real> ell4dret;	for(std::size_t iCurIter = 0; iCurIter<iIter; ++iCurIter)	{		const ResoResults& resores = m_res[iCurIter];		Ellipsoid4d<t_real> ell4d = calc_res_ellipsoid4d<t_real>(			resores.reso, resores.reso_v, resores.reso_s, resores.Q_avg);		unsigned int iNumThreads = get_max_threads();		std::size_t iNumPerThread = iNum / iNumThreads;		std::size_t iRemaining = iNum % iNumThreads;		tl::ThreadPool<void()> tp(iNumThreads);		for(unsigned iThread=0; iThread<iNumThreads; ++iThread)		{			std::vector<t_vec>::iterator iterBegin = vecNeutrons.begin() + iNumPerThread*iThread + iCurIter*iNum;			std::size_t iNumNeutr = iNumPerThread;			if(iThread == iNumThreads-1)				iNumNeutr = iNumPerThread + iRemaining;			tp.AddTask([iterBegin, iNumNeutr, this, &ell4d]()				{ mc_neutrons<t_vec>(ell4d, iNumNeutr, this->m_opts, iterBegin); });		}		tp.StartTasks();		auto& lstFut = tp.GetFutures();		for(auto& fut : lstFut)			fut.get();		if(iCurIter == 0)			ell4dret = ell4d;	}	//mc_neutrons<t_vec>(ell4d, iNum, m_opts, vecNeutrons.begin());	return ell4dret;}
开发者ID:t-weber,项目名称:takin,代码行数:52,


示例8: find_goldbachs

/* * Iterate backwards through list of primes then form difference between prime * and input. Then perform a binary search for this difference. * Number of primes less than n is O (n / log n) so searching takes  * O ( log (n / log n) ) = O ( log n - log log n ) = O ( log n ) * Iterating through primes and binary searching thus takes: * O(n / log n * log n) = O(n) */std::vector<TwoPrimes> find_goldbachs(std::vector<int> &primes, int input,                                      bool all_pairs) {    int num_primes = primes.size();    std::vector<TwoPrimes> result;        for(int i = num_primes - 1; i >= 0; --i) {         int p1 = primes[i];        int p2 = input - p1;        //binary search for p2 in primes        bool found_p2 = std::binary_search(primes.begin(), primes.end(), p2);            if(found_p2) {                if(all_pairs == false) {                    TwoPrimes tp(p1, p2);                    result.push_back(tp);                    return result;                }                TwoPrimes tp(p1, p2);                result.push_back(tp);            };    }    return result;}
开发者ID:luke-1993,项目名称:C-,代码行数:32,


示例9: insert

 vector<Interval> insert(vector<Interval>& intervals, Interval newInterval) {     intervals.push_back(newInterval);     int n = intervals.size();     compare cmp;     sort(intervals.begin(), intervals.end(), cmp);          vector<Interval> v;     v.clear();     int b = intervals[0].start, mx = intervals[0].end;     for(int i = 1; i < n; i++) {         if(intervals[i].start <= mx) {             mx = max(mx, intervals[i].end);         }         else {             Interval tp(b, mx);             v.push_back(tp);             b = intervals[i].start;             mx = intervals[i].end;         }     }     Interval tp(b, mx);     v.push_back(tp);     return v; }
开发者ID:maybeluo,项目名称:leetcode,代码行数:24,


示例10: redrawIfNecessary

	void Canvas::draw()	{		redrawIfNecessary();		ofImage* cairoTexture = texture.getTextureRef();		cairoTexture->bind();		ofDrawQuadTextured(polygon.getVertexs(), ofTexCoordsFor());		cairoTexture->unbind();		for (map<int, DataTouch>::const_iterator t = touchPoints.begin(); t != touchPoints.end(); ++t)		{			ofSetColor(kRGBBlue);			ofVec3f tp(t->second.getTouchPoint());			ofCircle(tp.x, tp.y, tp.z, 0.003);		}	}
开发者ID:Kaftan777ski,项目名称:mapinect,代码行数:15,


示例11: setw

void ConfusionMatrix::print_summary() {  // overall counts and summary  cout.precision(4);  cout << "== Summary ==" << endl;  cout << setw(23) <<"Correctly classified:" << setw(12) << right << correct << setw(10) << right << accuracy() * 100 << "%" << endl;  cout << setw(23) << "Incorrectly classified:" << setw(12) << right << incorrect << setw(10) << right << error() * 100 << "%" << endl;  cout << setw(23) << "Total classifications:" << setw(12) << right << correct + incorrect << endl << endl;    // determine the width of the left (category name) column  int max_name_length = 0;  for(int category = 1; category <= data_set->categories_size(); category++)    if(data_set->category_feature()->names[category].length() > max_name_length)      max_name_length = data_set->category_feature()->names[category].length();  if(average_row_name.length() > max_name_length)    max_name_length = average_row_name.length();  max_name_length += 1;    // detailed category information  cout << "== Category Performance ==" << endl;  cout << setw(max_name_length) << "";  cout << setw(9) << right << "True +";  cout << setw(9) << right << "False +";  cout << setw(9) << right << "True -";  cout << setw(9) << right << "False -";  cout << setw(9) << right << "Precis.";  cout << setw(9) << right << "Recall";  cout << setw(9) << right << "F-score" << endl;    for(int category = 1; category <= data_set->categories_size(); category++) {    cout << setw(max_name_length) << data_set->category_feature()->names[category];    cout << setw(9) << tp(category);    cout << setw(9) << fp(category);    cout << setw(9) << tn(category);    cout << setw(9) << fn(category);    cout << setw(8) << precision(category) * 100 << "%";    cout << setw(8) << recall(category) * 100 << "%";    cout << setw(8) << fscore(category) * 100 << "%" << endl;  }    cout << setw(max_name_length) << average_row_name;  cout << setw(9) << avg_tp();  cout << setw(9) << avg_fp();  cout << setw(9) << avg_tn();  cout << setw(9) << avg_fn();  cout << setw(8) << avg_precision() * 100 << "%";  cout << setw(8) << avg_recall() * 100 << "%";  cout << setw(8) << avg_fscore() * 100 << "%" << endl;}
开发者ID:willcannings,项目名称:quarry,代码行数:48,


示例12: tp

void WEpochAveragingTotal::addEmmSum( const WLEMMeasurement::ConstSPtr emm ){    WLTimeProfiler tp( CLASS, "addEmmSum" );    ++m_count;    WLEMData::ConstSPtr emdIn;    WLEMData::SPtr emdSum;    for( size_t mod = 0; mod < emm->getModalityCount(); ++mod )    {        emdIn = emm->getModality( mod );        emdSum = m_emmSum->getModality( mod );        const WLEMData::DataT& dataIn = emdIn->getData();        WLEMData::DataT& dataSum = emdSum->getData();        dataSum += dataIn;    }}
开发者ID:labp,项目名称:na-online_ow-toolbox,代码行数:16,


示例13: tp

/// Return a map containing all metrics.StringMapDouble CoverMetrics::all() const {    StringMapDouble m;    m["tp"] = tp();    m["fp"] = fp();    m["tn"] = tn();    m["fn"] = fn();    m["precision"]   = precision();    m["recall"]      = recall();    m["f1score"]     = f1score();    m["accuracy"]    = accuracy();    m["fprate"]      = fprate();    m["specificity"] = specificity();    m["fnrate"]      = fnrate();    m["matthews"]    = matthews();    return m;}
开发者ID:estnltk,项目名称:pfe,代码行数:17,


示例14: updateUavLatLng

void UAV::sendCurrentTelem(){    updateUavLatLng();    Protocol::TelemetryPacket tp(telemSeqNumber++);    double velocity_x = qrand() % 30 + 80;    double velocity_y = qrand() % 30 + 80;    double velocity_z = qrand() % 30 + 80;    double altitude = qrand() % 75 + 150;    tp.SetVelocity(velocity_x, velocity_y, velocity_z);    tp.SetOrientation(4,5,6);    tp.SetLocation(uavLat, uavLng, altitude);    tp.SetHeading(10);    sendAPacket(&tp);    }
开发者ID:JordanDickson,项目名称:GroundStation,代码行数:16,


示例15: tp

 // Called by Cocos when touches have ended void CocosTouchLayer::ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) {     // Go over all the touchs in the set     for (CCSetIterator it = pTouches->begin(); it != pTouches->end(); it++)     {         // Translate touch position to GL coordinates         CCTouch *ccTouch = (CCTouch *)(*it);         CCPoint pos = CCDirector::sharedDirector()->convertToUI(ccTouch->locationInView(ccTouch->view()));                  // Create a new ichigo touch object with the new position         TouchPoint tp((int)ccTouch, pos.x, pos.y);                  // Let the event manager handle this touch         EventManager::getInstance()->onTouchEnded(&tp);     }         }
开发者ID:Avnerus,项目名称:ichigo,代码行数:17,


示例16: TEST

// See if we can insert some tagsTEST(ThreadProfile, InsertTagsNoWrap) {  PseudoStack* stack = new PseudoStack();  Thread::tid_t tid = 1000;  ThreadInfo info("testThread", tid, true, stack, nullptr);  ThreadProfile tp(&info, 100);  int test_size = 50;  for (int i = 0; i < test_size; i++) {    tp.addTag(ProfileEntry('t', i));  }  ASSERT_TRUE(tp.mEntries != nullptr);  int readPos = tp.mReadPos;  while (readPos != tp.mWritePos) {    ASSERT_TRUE(tp.mEntries[readPos].mTagName == 't');    ASSERT_TRUE(tp.mEntries[readPos].mTagInt == readPos);    readPos = (readPos + 1) % tp.mEntrySize;  }}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:18,


示例17: GetCurrRun

/**  CLinePtr::GetAdjustedLineLength**  @mfunc  returns the length of the line _without_ EOP markers**  @rdesc  LONG; the length of the line*/LONG CLinePtr::GetAdjustedLineLength(){    CLine* pline = GetCurrRun();    Assert(pline);    LONG cchJunk;    LONG cchTrim;    CTreePos *ptpRet, *ptpPrev;    LONG cpEndLine = _pdp->GetFirstCp() + GetCp() - GetIch() + pline->_cch;    CTreePos* ptp = _pdp->GetMarkup()->TreePosAtCp(cpEndLine, &cchJunk);    _pdp->EndNodeForLine(cpEndLine, ptp, &cchTrim, &ptpRet, NULL);    cchTrim = min(cchTrim, pline->_cch);    LONG cpNewMost = cpEndLine - cchTrim;    if(ptpRet)    {        ptpPrev = ptpRet;        if(ptpPrev->GetCch()==0 || ptpPrev->IsNode() || (ptpPrev->IsText() && ptpPrev->GetCp()>=cpNewMost))        {            do            {                ptpPrev = ptpPrev->PreviousTreePos();            } while(ptpPrev->GetCch() == 0);        }        if(ptpPrev->IsEndElementScope() && ptpPrev->Branch()->Tag()==ETAG_BR)        {            cchTrim += 2;        }        else if(ptpPrev->IsText())        {            CTxtPtr tp(_pdp->GetMarkup(), cpNewMost-1);            if(tp.GetChar() == WCH_ENDPARA1)            {                cchTrim++;            }        }    }    cchTrim = min(cchTrim, pline->_cch);    return pline->_cch-cchTrim;}
开发者ID:hufuman,项目名称:xindows,代码行数:53,


示例18: tp

void SPUse::print(SPPrintContext* ctx) {    bool translated = false;    if ((this->x._set && this->x.computed != 0) || (this->y._set && this->y.computed != 0)) {        Geom::Affine tp(Geom::Translate(this->x.computed, this->y.computed));        sp_print_bind(ctx, tp, 1.0);        translated = true;    }    if (this->child) {        this->child->invoke_print(ctx);    }    if (translated) {        sp_print_release(ctx);    }}
开发者ID:AakashDabas,项目名称:inkscape,代码行数:17,


示例19: databaseDataInstance

QSqlDatabase QMail::createDatabase(){    if (!databaseDataInstance()->hasLocalData()) {        databaseDataInstance()->setLocalData(new QDatabaseInstanceData);    }    QDatabaseInstanceData* instance = databaseDataInstance()->localData();    QSqlDatabase db;    if (instance->init) {        db = QSqlDatabase::database("qmailstore_sql_connection");    } else {        qMailLog(Messaging) << "opening database";        db = QSqlDatabase::addDatabase("QSQLITE", "qmailstore_sql_connection");                QDir dbDir(dataPath() + "database");        if (!dbDir.exists()) {#ifdef Q_OS_UNIX            QString path = dataPath();            if (path.endsWith('/'))                path = path.left(path.length() - 1);            if (!QDir(path).exists() && ::mkdir(QFile::encodeName(path), S_IRWXU) == -1)                qCritical() << "Cannot create database directory: " << errno;#endif            if (!dbDir.mkpath(dataPath() + "database"))                qCritical() << "Cannot create database path";        }        db.setDatabaseName(dataPath() + "database/qmailstore.db");#endif        if(!db.open()) {            QSqlError dbError = db.lastError();            qCritical() << "Cannot open database: " << dbError.text();        }        QDir tp(tempPath());        if(!tp.exists())            if(!tp.mkpath(tempPath()))                qCritical() << "Cannot create temp path";        instance->init = true;    }    return db;}
开发者ID:chriadam,项目名称:messagingframework,代码行数:45,


示例20: assert

voidTrace::push_back(const AircraftState& state){  assert(cached_size == delta_list.size());  assert(cached_size == chronological_list.Count());  if (empty()) {    // first point determines origin for flat projection    task_projection.reset(state.location);    task_projection.update_fast();  } else if (state.time < fixed(back().GetTime())) {    // gone back in time    if (unsigned(state.time) + 180 < back().GetTime()) {      /* not fixable, clear the trace and restart from scratch */      clear();      return;    }    /* not much, try to fix it */    EraseLaterThan(unsigned(state.time) - 10);  } else if ((unsigned)state.time - back().GetTime() < 2)    // only add one item per two seconds    return;  TracePoint tp(state);  tp.project(task_projection);  EnforceTimeWindow(tp.GetTime());  if (size() >= max_size)    Thin();  assert(size() < max_size);  TraceDelta &td = Insert(tp);  td.InsertBefore(chronological_list);  ++cached_size;  if (!chronological_list.IsFirst(td))    UpdateDelta(td.GetPrevious());  ++append_serial;}
开发者ID:damianob,项目名称:xcsoar,代码行数:45,


示例21: tp

void CAICallback::DrawUnit(const char* name,float3 pos,float rotation,int lifetime,int team,bool transparent,bool drawBorder){	CUnitDrawer::TempDrawUnit tdu;	tdu.unitdef=unitDefHandler->GetUnitByName(name);	if(!tdu.unitdef){		info->AddLine("Uknown unit in CAICallback::DrawUnit %s",name);		return;	}	tdu.pos=pos;	tdu.rot=rotation;	tdu.team=team;	tdu.drawBorder=drawBorder;	std::pair<int,CUnitDrawer::TempDrawUnit> tp(gs->frameNum+lifetime,tdu);	if(transparent)		unitDrawer->tempTransperentDrawUnits.insert(tp);	else		unitDrawer->tempDrawUnits.insert(tp);}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:18,


示例22: test_constexpr_pair

void test_constexpr_pair() {#if STL2_CONSTEXPR_EXTENSIONS  constexpr auto t = tp(42, 3.14);  static_assert(__stl2::models::Same<decltype(t), const TP>);  constexpr int f = t.first;  CHECK(f == 42);  constexpr int fg = __stl2::get<0>(t);  CHECK(fg == 42);  constexpr int ff = t.in();  CHECK(ff == 42);  constexpr double s = t.second;  CHECK(s == 3.14);  constexpr double sg = __stl2::get<1>(t);  CHECK(sg == 3.14);  constexpr double sf = t.out();  CHECK(sf == 3.14);#endif}
开发者ID:mkurdej,项目名称:cmcstl2,代码行数:18,


示例23: xarray_from_pylist

inline dynd::ndt::type xarray_from_pylist(PyObject *obj){  // TODO: Add ability to specify access flags (e.g. immutable)  // Do a pass through all the data to deduce its type and shape  std::vector<intptr_t> shape;  dynd::ndt::type tp(dynd::void_id);  Py_ssize_t size = PyList_GET_SIZE(obj);  shape.push_back(size);  for (Py_ssize_t i = 0; i < size; ++i) {    deduce_pylist_shape_and_dtype(PyList_GET_ITEM(obj, i), shape, tp, 1);  }  if (tp.get_id() == dynd::void_id) {    tp = dynd::ndt::type(dynd::int32_id);  }  return dynd::ndt::make_type(shape.size(), shape.data(), tp);}
开发者ID:arnavkj1995,项目名称:dynd-python,代码行数:18,


示例24: bdbdump

int bdbdump(int argc, char* argv[], bool dumpFormat){	char*			slash;	char*			filename;	Table*			table;	TablePrinter	tp(dumpFormat);	bool			ret;	DatabaseConfig	dbConfig;	if (argc < 2)	{		printf("usage: bdbdump db-file/n");		exit(1);	}		dbConfig.dir = ".";	filename = argv[1];	if ((slash = strrchr(filename, '/')) != NULL)	{		dbConfig.dir = argv[1];		*slash = '/0';		filename = slash + 1;		if (chdir(dbConfig.dir) < 0)		{			printf("cannot find database directory!/n");			exit(1);		}		dbConfig.dir = ".";	}		ret = database.Init(dbConfig);	if (!ret)	{		printf("cannot initialise database!/n");		exit(1);	}		table = new Table(&database, filename);	table->Visit(tp);		delete table;		return 0;}
开发者ID:Kaperstone,项目名称:keyspace,代码行数:44,


示例25: server

void server(){    std::cout << "Server" << std::endl;    int server_fd = sock_listen("12345", 10, NULL);    if ( server_fd == -1 )    {        std::cout << "sock_listen error " << errno << " " << strerror( errno ) << std::endl;        exit(1);    }    threadpool tp(10);    while (true)    {        sockaddr_storage client_addr;        socklen_t len = sizeof(client_addr);        int client_fd = accept(server_fd, (sockaddr*)&client_addr, &len);        tp.add_task( [client_fd] () {            print_client_info("New client - ", client_addr);            std::cout<<std::endl;            char buf[BUF_SIZE];            memset(buf, 0, sizeof(buf) );            ssize_t num_recv = recv(client_fd, buf, BUF_SIZE, 0);            std::cout << "num_recv " << num_recv << " " << buf << std::endl;            sleep(2);            strncpy(buf, "abcdef", BUF_SIZE);            ssize_t num_sent = send(client_fd, buf, strlen(buf)+1, 0);            std::cout << "num_sent " << num_sent << std::endl;            close( client_fd );        });    }}
开发者ID:marcinklimek,项目名称:cpp_rt_2,代码行数:44,


示例26: tp

void CAICallback::DrawUnit(const char* unitName,float3 pos,float rotation,int lifetime,int teamId,bool transparent,bool drawBorder,int facing){	CUnitDrawer::TempDrawUnit tdu;	tdu.unitdef=unitDefHandler->GetUnitByName(unitName);	if(!tdu.unitdef){		logOutput.Print("Uknown unit in CAICallback::DrawUnit %s",unitName);		return;	}	tdu.pos=pos;	tdu.rotation=rotation;	tdu.team=teamId;	tdu.drawBorder=drawBorder;	tdu.facing=facing;	std::pair<int,CUnitDrawer::TempDrawUnit> tp(gs->frameNum+lifetime,tdu);	if(transparent)		unitDrawer->tempTransparentDrawUnits.insert(tp);	else		unitDrawer->tempDrawUnits.insert(tp);}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:19,


示例27: name

void PbrtSceneImporter::_pbrtTexture(PbrtImport::SubString i_name, PbrtImport::SubString i_type, PbrtImport::SubString i_texname, const PbrtImport::ParamSet &i_params)  {  if (_VerifyWorld("Texture")==false) return;  std::string name(i_name.to_string()), type(i_type.to_string()), texname(i_texname.to_string());  PbrtImport::TextureParams tp(i_params, i_params, m_graphicsState.floatTextures, m_graphicsState.spectrumTextures);  if (type == "float")    {    intrusive_ptr<const Texture<double>> ft = m_texture_factory.CreateFloatTexture(texname, m_current_transform, tp);    if (ft) m_graphicsState.floatTextures[name] = ft;    }  else if (type == "color")     {    intrusive_ptr<const Texture<SpectrumCoef_d>> st = m_texture_factory.CreateSpectrumCoefTexture(texname, m_current_transform, tp);    if (st) m_graphicsState.spectrumTextures[name] = st;    }  else    PbrtImport::Utils::LogError(mp_log, std::string("Texture type ") + type + std::string(" unknown."));  }
开发者ID:neodyme60,项目名称:Skwarka,代码行数:19,


示例28: epoll

EventEngine::Ptr EventEngineFactory::createTP(const Config& p_config){  Epoll::Ptr epoll(new Epoll());  EpollED::Ptr epollED(new EpollED(epoll));  EventEngines::ThreadPool::Ptr tp(new EventEngines::ThreadPool(epollED, p_config.eventEngineSize));  KeyboardSocket::Ptr keybSocket(new KeyboardSocket());  KeyboardES::Ptr keybES(new KeyboardES(keybSocket));  EventHandler::Ptr keybEH(new KeyboardTPEH("log.txt", keybES, *tp));  TcpSocket::Ptr listenerSokcet(new TcpSocket());  ListenerES::Ptr listenerES(new ListenerES(listenerSokcet, p_config.port));  EventHandler::Ptr acceptorEH(new AcceptorEH<EventEngines::ThreadPool>(listenerES, *tp));  tp->add(keybEH);  tp->add(acceptorEH);  return EventEngine::Ptr(new ThreadPoolEE(tp));}
开发者ID:RomanUlan,项目名称:AllInOne,代码行数:19,


示例29: solve

double solve(){	point tp(0,0,0),end(0,0,1),vec;	double ang;	int i,cn;	if(sign(a)) tp.x=d/a;	else if(sign(b)) tp.y=d/b;	else if(sign(c)) tp.z=d/c;	ps[n+1]=tp;	vec=(point(a,b,c))*(end);	if(sign(vec.x)==0) vec.x=0;	if(sign(vec.y)==0) vec.y=0;	if(sign(vec.z)==0) vec.z=0;	ang=(a*end.x+b*end.y+c*end.z)/(point(a,b,c).getlen());	ang=acos(ang);	if(sign(ang)!=-0 && sign(ang-PI)!=0)	for(i=0;i<n;i++) ps[i]=rotate(org,vec,ps[i],ang);	for(int i=0;i<n;i++) ps[i].z=0;	//然后求凸包面积	return ans;}
开发者ID:MaxVINO,项目名称:ACMICPC,代码行数:19,


示例30: curs_set

/* * Set the cursor visibility (0 = invis, 1 = normal, 2 = bright) */static void curs_set(int vis){	char *v = NULL;	if (!vis)	{		v = vi;	}	else if (vis > 1)	{		v = vs ? vs : ve;	}	else	{		v = ve ? ve : vs;	}	if (v) tp(v);}
开发者ID:MarvinPA,项目名称:mpa-sil,代码行数:22,



注:本文中的tp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tp_clear_object函数代码示例
C++ touchwin函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。