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

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

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

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

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

示例1: ensureCreated

GLuint QGLPixmapData::bind(bool copyBack) const{    ensureCreated();    GLuint id = m_texture.id;    glBindTexture(GL_TEXTURE_2D, id);    if (m_hasFillColor) {            m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied);            m_source.fill(PREMUL(m_fillColor.rgba()));        m_hasFillColor = false;        GLenum format = qt_gl_preferredTextureFormat();        QImage tx(w, h, QImage::Format_ARGB32_Premultiplied);        tx.fill(qt_gl_convertToGLFormat(m_fillColor.rgba(), format));        glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, tx.constBits());    }    return id;}
开发者ID:66eli77,项目名称:RadChip,代码行数:21,


示例2: tx

void MultithreadTest::TestAnyTranslit() {#if !UCONFIG_NO_TRANSLITERATION    UErrorCode status = U_ZERO_ERROR;    LocalPointer<Transliterator> tx(Transliterator::createInstance("Any-Latin", UTRANS_FORWARD, status));    if (U_FAILURE(status)) {        dataerrln("File %s, Line %d: Error, status = %s", __FILE__, __LINE__, u_errorName(status));        return;    }    gSharedTranslit = tx.getAlias();    TxThread  threads[4];    int32_t i;    for (i=0; i<UPRV_LENGTHOF(threads); i++) {        threads[i].start();    }    for (i=0; i<UPRV_LENGTHOF(threads); i++) {        threads[i].join();    }    gSharedTranslit = NULL;#endif  // !UCONFIG_NO_TRANSLITERATION}
开发者ID:Cyril2004,项目名称:proto-quic,代码行数:21,


示例3: autofill_fee

/** Fill in the fee on behalf of the client.    This is called when the client does not explicitly specify the fee.    The client may also put a ceiling on the amount of the fee. This ceiling    is expressed as a multiplier based on the current ledger's fee schedule.    JSON fields    "Fee"   The fee paid by the transaction. Omitted when the client            wants the fee filled in.    "fee_mult_max"  A multiplier applied to the current ledger's transaction                    fee that caps the maximum the fee server should auto fill.                    If this optional field is not specified, then a default                    multiplier is used.    @param tx       The JSON corresponding to the transaction to fill in    @param ledger   A ledger for retrieving the current fee schedule    @param result   A JSON object for injecting error results, if any    @param admin    `true` if this is called by an administrative endpoint.*/static void autofill_fee (Json::Value& request,    Ledger::pointer ledger, Json::Value& result, bool admin){    Json::Value& tx (request["tx_json"]);    if (tx.isMember ("Fee"))        return;    int mult = DEFAULT_AUTO_FILL_FEE_MULTIPLIER;    if (request.isMember ("fee_mult_max"))    {        if (request["fee_mult_max"].isNumeric ())        {            mult = request["fee_mult_max"].asInt();        }        else        {            RPC::inject_error (rpcHIGH_FEE, RPC::expected_field_message (                "fee_mult_max", "a number"), result);            return;        }    }    std::uint64_t const feeDefault = getConfig().FEE_DEFAULT;    // Administrative endpoints are exempt from local fees    std::uint64_t const fee = ledger->scaleFeeLoad (feeDefault, admin);    std::uint64_t const limit = mult * feeDefault;    if (fee > limit)    {        std::stringstream ss;        ss <<            "Fee of " << fee <<            " exceeds the requested tx limit of " << limit;        RPC::inject_error (rpcHIGH_FEE, ss.str(), result);        return;    }    tx ["Fee"] = static_cast<int>(fee);}
开发者ID:naumenkogs,项目名称:blockverify-core,代码行数:60,


示例4: runtime_error

//signvoid MultisigDialog::on_signButton_clicked(){    if(!model)        return;   try{        //parse tx hex        CTransaction txRead;        if(!DecodeHexTx(txRead, ui->transactionHex->text().toStdString())){            throw runtime_error("Failed to decode transaction hex!");        }        CMutableTransaction tx(txRead);        //check if transaction is already fully verified        if(isFullyVerified(tx)){            this->multisigTx = tx;            ui->commitButton->setEnabled(true);            ui->signButtonStatus->setText("This transaction is ready to commit. /nThe commit button in now enabled.");            return;        }        string errorOut = string();        bool fComplete = signMultisigTx(tx, errorOut, ui->keyList);        if(!errorOut.empty()){            throw runtime_error(errorOut.data());        }else{            this->multisigTx = tx;        }        ui->signButtonStatus->setStyleSheet("QTextEdit{ color: black }");        ui->signButtonStatus->setText(buildMultisigTxStatusString(fComplete, tx));    }catch(const runtime_error& e){        ui->signButtonStatus->setStyleSheet("QTextEdit{ color: red }");        ui->signButtonStatus->setText(tr(e.what()));    }}
开发者ID:michaili,项目名称:PIVX,代码行数:39,


示例5: tx

void MultisigDialog::commitMultisigTx(){    CMutableTransaction tx(multisigTx);    try{#ifdef ENABLE_WALLET        CWalletTx wtx(pwalletMain, tx);        CReserveKey keyChange(pwalletMain);        if (!pwalletMain->CommitTransaction(wtx, keyChange))            throw runtime_error(string("Transaction rejected - Failed to commit"));#else        uint256 hashTx = tx.GetHash();        CCoinsViewCache& view = *pcoinsTip;        const CCoins* existingCoins = view.AccessCoins(hashTx);        bool fOverrideFees = false;        bool fHaveMempool = mempool.exists(hashTx);        bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;        if (!fHaveMempool && !fHaveChain) {            // push to local node and sync with wallets            CValidationState state;            if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {                if (state.IsInvalid())                    throw runtime_error(strprintf("Transaction rejected - %i: %s", state.GetRejectCode(), state.GetRejectReason()));                else                    throw runtime_error(string("Transaction rejected - ") + state.GetRejectReason());            }        } else if (fHaveChain) {            throw runtime_error("transaction already in block chain");        }        RelayTransaction(tx);#endif        //disable commit if successfully committed        ui->commitButton->setEnabled(false);        ui->signButtonStatus->setText(strprintf("Transaction has been successfully published with transaction ID:/n %s", tx.GetHash().GetHex()).c_str());    }catch(const runtime_error& e){        ui->signButtonStatus->setText(e.what());    }}
开发者ID:michaili,项目名称:PIVX,代码行数:38,


示例6: q_power_frobenius

void q_power_frobenius(ECn3 &S,ZZn2& X){	ZZn6 X1,X2,Y1,Y2;	ZZn3 Sx,Sy,T;	int qnr=get_mip()->cnr;	S.get(Sx,Sy);	// untwist        Sx=Sx/qnr;    Sy=tx(Sy);    Sy=Sy/(qnr*qnr);	X1=shuffle(Sx,(ZZn3)0); Y1=shuffle((ZZn3)0,Sy);	X1.powq(X); Y1.powq(X);	unshuffle(X1,Sx,T); unshuffle(Y1,T,Sy);		// twist	Sx=qnr*Sx;	Sy=txd(Sy*qnr*qnr);	S.set(Sx,Sy);}
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:23,


示例7: writer

void CropSpriteCommand::onExecute(Context* context){  ContextWriter writer(context);  Doc* document(writer.document());  Sprite* sprite(writer.sprite());  gfx::Rect bounds;  if (m_bounds.isEmpty())    bounds = document->mask()->bounds();  else    bounds = m_bounds;  {    Tx tx(writer.context(), "Sprite Crop");    document->getApi(tx).cropSprite(sprite, bounds);    tx.commit();  }#ifdef ENABLE_UI  if (context->isUIAvailable())    update_screen_for_document(document);#endif}
开发者ID:aseprite,项目名称:aseprite,代码行数:23,


示例8: writer

void RemoveFrameCommand::onExecute(Context* context){  ContextWriter writer(context);  Doc* document(writer.document());  Sprite* sprite(writer.sprite());  {    Tx tx(writer.context(), "Remove Frame");    DocApi api = document->getApi(tx);    const Site* site = writer.site();    if (site->inTimeline() &&        !site->selectedFrames().empty()) {      for (frame_t frame : site->selectedFrames().reversed()) {        api.removeFrame(sprite, frame);      }    }    else {      api.removeFrame(sprite, writer.frame());    }    tx.commit();  }  update_screen_for_document(document);}
开发者ID:aseprite,项目名称:aseprite,代码行数:23,


示例9: worker_thread

void * worker_thread(void *arg){	int cpu, v1;	cpu = sched_getcpu();	PRINT("worker_thread start on CPU %d/n",cpu);#ifdef __CALIBRATION__	calibrate_compensated_timer();#endif#ifdef __CALIBRATED_TIMER__	compensated_timer();#endif#ifdef __CALIBRATED_JIFFIE__	calibrate_lpj();#endif#ifdef __CALIBRATED_LSTREAM__	calibrate_lstream();#endif#ifdef __CALIBRATED_TX__	if(transmitter)		calibrated_tx();	else{		while(1){			v1 = *spinlock;			while(*spinlock == v1);			fprintf(stderr, "%d/n",v1);		}	}#endif#ifdef __AUTO_CALIBRATION__	auto_calibration_main(2393715000);#endif#ifdef __TX__	tx();#endif	return NULL;}
开发者ID:jackalexcasey,项目名称:doc,代码行数:37,


示例10: T

   void BivarStats<T>::add(const T& x, const T& y)   {      if (ns == 0)      {         sumX = sumY = sumX2 = sumY2 = sumXY = T(0);         xMin = xMax = x;         yMin = yMax = y;         scaleX = scaleY = T(1);      }      if (scaled)      {         if (scaleX==T(1) && x!=T()) scaleX=ABS(x);         if (scaleY==T(1) && y!=T()) scaleY=ABS(y);         T tx(x/scaleX);         T ty(y/scaleY);         sumX += tx;         sumY += ty;         sumX2 += tx*tx;         sumY2 += ty*ty;         sumXY += tx*ty;      }      else      {         sumX += x;         sumY += y;         sumX2 += x*x;         sumY2 += y*y;         sumXY += x*y;      }      if(x < xMin) xMin=x;      if(x > xMax) xMax=x;      if(y < yMin) yMin=y;      if(y > yMax) yMax=y;      ns++;   }
开发者ID:loongfee,项目名称:ossim-svn,代码行数:37,


示例11: main

int main() {  coord 	t(3);  coord		Q(3);  coord		R(3);  coord		pi(3);  coord		QxtxQ(3);  coord		txQ(3);  double 	k;  t[0] = 1.0;  t[1] = 2.0;  t[2] = 3.0;  pi[0] = -0.5;  pi[1] = -2.345;  pi[2] = 1.2345;  Q = pi;  R = pi - t;  transformMatrix tx(cross_prod, t[0], t[1], t[2]);  transformMatrix Qx(cross_prod, Q[0], Q[1], Q[2]);  //  txQ = tx*Q;  QxtxQ = Qx*tx*Q;  std::cout << "R0 = " << (R*Q).sum() << std::endl;  std::cout << "R1 = " << (R*QxtxQ).sum() << std::endl;  //std::cout << "R2 = " << (R*txQ).sum() << std::endl;  k = ((t*Q).sum() - (t*QxtxQ).sum()*(R*Q).sum()/(R*QxtxQ).sum())/(Q*Q).sum();  std::cout << "pi = " << k*Q << std::endl;  return(0);}
开发者ID:elliotwoods,项目名称:ProCamSolver,代码行数:37,


示例12: main

intmain(int argc, char *argv[]){	START(argc, argv, "obj_cpp_map");	if (argc != 3 || strchr("co", argv[1][0]) == nullptr)		UT_FATAL("usage: %s <c,o> file-name", argv[0]);	const char *path = argv[2];	nvobj::pool<root> pop;	bool open = (argv[1][0] == 'o');	try {		if (open) {			pop = nvobj::pool<root>::open(path, LAYOUT);		} else {			pop = nvobj::pool<root>::create(path, LAYOUT,							PMEMOBJ_MIN_POOL * 2,							S_IWUSR | S_IRUSR);			nvobj::transaction::manual tx(pop);			pop.get_root()->cons =				nvobj::make_persistent<containers>(pop);			nvobj::transaction::commit();		}	} catch (nvml::pool_error &pe) {		UT_FATAL("!pool::create: %s %s", pe.what(), path);	}	test_map(pop, open);	pop.close();	DONE(nullptr);}
开发者ID:tomaszkapela,项目名称:nvml,代码行数:36,


示例13: BrcmLbsRil_setUeState

/** Send the UeState to the GPS*   /param    ril - handle returned from BrcmLbsRil_init *   /param    protocol - BrcmCpHalAsn1_Protocol*   /param    state - BrcmLbsRilAsn1_UeState*********************************************************************************/BrcmLbs_Result BrcmLbsRil_setUeState(OsHandle ril,     BrcmLbsRilAsn1_Protocol protocol,    BrcmLbsRilAsn1_UeState state){    uint8_t buf[1024];    D("%s/n", __FUNCTION__);    brcm_marshall_func_init(buf, sizeof(buf), BRCMLBSRIL_SETUESTATE);    if (brcm_marshall_func_add_arg(buf, sizeof(buf), BRCM_MARSHALL_ARG_UINT32,         (uint32_t)protocol, NULL, 0) < 0)    {        return BRCM_LBS_ERROR_PARAMETER_INVALID;    }    if (brcm_marshall_func_add_arg(buf, sizeof(buf), BRCM_MARSHALL_ARG_UINT32,         (uint32_t)state, NULL, 0) < 0)    {        return BRCM_LBS_ERROR_PARAMETER_INVALID;    }    return tx(ril, buf, brcm_marshall_get_len(buf, sizeof(buf)));}
开发者ID:blackfa1con,项目名称:hardware_rk29_gps,代码行数:29,


示例14: checkMeta

bool checkMeta(const char* path,	       const char* sval, double* dvals, int ndvals, int16_t* ivals, int nivals,	       const char* xval){    std::string error;    PtexPtr<PtexTexture> tx(PtexTexture::open(path, error));    if (!tx) {	std::cerr << error << std::endl;	return 0;    }    PtexPtr<PtexMetaData> meta(tx->getMetaData());    const char* f_sval;    meta->getValue("sval", f_sval);    const double* f_dvals;    int f_ndvals;    meta->getValue("dvals", f_dvals, f_ndvals);    const int16_t* f_ivals;    int f_nivals;    meta->getValue("ivals", f_ivals, f_nivals);    const char* f_xval;    meta->getValue("xval", f_xval);    bool ok = ((!sval || 0==strcmp(sval, f_sval)) &&	       (!ndvals || ndvals == f_ndvals && 0==memcmp(dvals, f_dvals, ndvals*sizeof(dvals[0]))) &&	       (!nivals || nivals == f_nivals && 0==memcmp(ivals, f_ivals, nivals*sizeof(ivals[0]))) &&	       (!xval || 0==strcmp(xval, f_xval)));    if (!ok) {	std::cerr << "Meta data readback failed" << std::endl;	return 0;    }    return 1;}
开发者ID:aashish24,项目名称:ptex,代码行数:36,


示例15: BM_log_delay

/* *	Measure the time it takes for the logd posting call to make it into * the logs. Expect this to be less than double the process wakeup time (2ms). */static void BM_log_delay(int iters) {    pid_t pid = getpid();    struct logger_list * logger_list = android_logger_list_open(LOG_ID_EVENTS,        O_RDONLY, 0, pid);    if (!logger_list) {        fprintf(stderr, "Unable to open events log: %s/n", strerror(errno));        exit(EXIT_FAILURE);    }    signal(SIGALRM, caught_delay);    alarm(alarm_time);    StartBenchmarkTiming();    for (int i = 0; i < iters; ++i) {        log_time ts(CLOCK_REALTIME);        LOG_FAILURE_RETRY(            android_btWriteLog(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));        for (;;) {            log_msg log_msg;            int ret = android_logger_list_read(logger_list, &log_msg);            alarm(alarm_time);            if (ret <= 0) {                iters = i;                break;            }            if ((log_msg.entry.len != (4 + 1 + 8))             || (log_msg.id() != LOG_ID_EVENTS)) {                continue;            }            char* eventData = log_msg.msg();            if (eventData[4] != EVENT_TYPE_LONG) {                continue;            }            log_time tx(eventData + 4 + 1);            if (ts != tx) {                if (0xDEADBEEFA55A5AA6ULL == caught_convert(eventData + 4 + 1)) {                    iters = i;                    break;                }                continue;            }            break;        }    }    signal(SIGALRM, SIG_DFL);    alarm(0);    StopBenchmarkTiming();    android_logger_list_free(logger_list);}
开发者ID:0111abhi,项目名称:platform_system_core,代码行数:65,


示例16: GetFontName

voidPDFWriter::DrawChar(uint16 unicode, const char* utf8, int16 size){	// try to convert from utf8 to MacRoman encoding schema...	int32 srcLen  = size;	int32 destLen = 1;	char dest[3] = "/0/0";	int32 state = 0;	bool embed = true;	font_encoding encoding = macroman_encoding;	char fontName[B_FONT_FAMILY_LENGTH+B_FONT_STYLE_LENGTH+1];	if (convert_from_utf8(B_MAC_ROMAN_CONVERSION, utf8, &srcLen, dest, &destLen,			&state, 0) != B_OK || dest[0] == 0) {		// could not convert to MacRoman		font_encoding fenc;		uint16 index = 0;		uint8 enc;		GetFontName(&fState->beFont, fontName);		embed = EmbedFont(fontName);		REPORT(kDebug, -1, "find_encoding unicode %d/n", (int)unicode);		if (find_encoding(unicode, enc, index)) {			// is code point in the Adobe Glyph List?			// Note if rendering the glyphs only would be desired, we could			// always use the second method below (MakeUserDefinedEncoding),			// but extracting text from the generated PDF would be almost			// impossible (OCR!)			REPORT(kDebug, -1, "encoding for %x -> %d %d", unicode, (int)enc,				(int)index);			// use one of the user pre-defined encodings			if (fState->beFont.FileFormat() == B_TRUETYPE_WINDOWS) {				encoding = font_encoding(enc + tt_encoding0);			} else {				encoding = font_encoding(enc + t1_encoding0);			}			*dest = index;		} else if (embed) {			// if the font is embedded, create a user defined encoding at runtime			uint8 index;			MakeUserDefinedEncoding(unicode, enc, index);			*dest = index;			encoding = font_encoding(user_defined_encoding_start + enc);		} else if (find_in_cid_tables(unicode, fenc, index, fFontSearchOrder)) {			// font is not embedded use one of the CJK fonts for substitution			REPORT(kDebug, -1, "cid table %d index = %d", (int)fenc, (int)index);			dest[0] = unicode / 256;			dest[1] = unicode % 256;			destLen = 2;			encoding = fenc;			embed = false;		} else {			static bool found = false;			REPORT(kDebug, -1, "encoding for %x not found!", (int)unicode);			if (!found) {				found = true;				REPORT(kError, fPage, "Could not find an encoding for character "					"with unicode %d! Message is not repeated for other unicode "					"values.", (int)unicode);			}			*dest = 0; // paint a box (is 0 a box in MacRoman) or			return; // simply skip character		}	} else {		REPORT(kDebug, -1, "macroman srcLen=%d destLen=%d dest= %d %d!", srcLen,			destLen, (int)dest[0], (int)dest[1]);	}	// Note we have to build the user defined encoding before it is used in	// PDF_find_font!	if (!MakesPDF()) return;	int		font;	GetFontName(&fState->beFont, fontName, embed, encoding);	font = FindFont(fontName, embed, encoding);	if (font < 0) {		REPORT(kWarning, fPage, "**** PDF_findfont(%s) failed, back to default "			"font", fontName);		font = PDF_findfont(fPdf, "Helvetica", "macroman", 0);	}	fState->font = font;	uint16 face = fState->beFont.Face();	PDF_set_parameter(fPdf, "underline", (face & B_UNDERSCORE_FACE) != 0		? "true" : "false");	PDF_set_parameter(fPdf, "strikeout", (face & B_STRIKEOUT_FACE) != 0		? "true" : "false");	PDF_set_value(fPdf, "textrendering", (face & B_OUTLINED_FACE) != 0 ? 1 : 0);	PDF_setfont(fPdf, fState->font, scale(fState->beFont.Size()));	const float x = tx(fState->penX);	const float y = ty(fState->penY);	const float rotation = fState->beFont.Rotation();	const bool rotate = rotation != 0.0;	if (rotate) {//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,


示例17: serialRegsInit

void serialRegsInit( void ){	tx( prompt );}
开发者ID:boundarydevices,项目名称:at91,代码行数:4,


示例18: maktab

voidmaktab(void){# define FN(i,c) font[stynum[i]][c]# define SZ(i,c) csize[stynum[i]][c]	/* define the tab stops of the table */	int icol, ilin, tsep, k, ik, vforml, il, text;	int doubled[MAXCOL], acase[MAXCOL];	char *s;	char space[40];	for(icol=0; icol <ncol; icol++)	{		doubled[icol] = acase[icol] = 0;		fprintf(tabout, ".nr %d 0/n", icol+CRIGHT);		for(text=0; text<2; text++)		{			if (text) {				warnoff();				fprintf(tabout, ".%02d/n.rm %02d/n", icol+80, icol+80);				warnon();			}			for(ilin=0; ilin<nlin; ilin++)			{				if (instead[ilin]|| fullbot[ilin]) continue;				vforml=ilin;				for(il=prev(ilin); il>=0 && vspen(table[il][icol].col); il=prev(il))					vforml=il;				if (fspan(vforml,icol)) continue;				if (filler(table[ilin][icol].col)) continue;				switch(ctype(vforml,icol))				{				case 'a':					acase[icol]=1;					s = table[ilin][icol].col;					if (tx(s) && text)					{						if (doubled[icol]==0)							fprintf(tabout, ".nr %d 0/n.nr %d 0/n",S1,S2);						doubled[icol]=1;						nreg(space, sizeof(space), s,						    '-');						fprintf(tabout, ".if %s>//n(%d .nr %d %s/n",space,S2,S2,space);					}				case 'n':					if (table[ilin][icol].rcol!=0)					{						if (doubled[icol]==0 && text==0)							fprintf(tabout, ".nr %d 0/n.nr %d 0/n", S1, S2);						doubled[icol]=1;						if (real(s=table[ilin][icol].col) && !vspen(s))						{							if (tx(s) != text) continue;							fprintf(tabout, ".nr %d ", TMP);							wide(s, FN(vforml,icol), SZ(vforml,icol)); fprintf(tabout, "/n");							fprintf(tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n", S1, TMP, S1, TMP);						}						if (text==0 && real(s=table[ilin][icol].rcol) && !vspen(s) && !barent(s))						{							fprintf(tabout, ".nr %d //w%c%s%c/n",TMP, F1, s, F1);							fprintf(tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n",S2,TMP,S2,TMP);						}						continue;					}				case 'r':				case 'c':				case 'l':					if (real(s=table[ilin][icol].col) && !vspen(s))					{						if (tx(s) != text) continue;						fprintf(tabout, ".nr %d ", TMP);						wide(s, FN(vforml,icol), SZ(vforml,icol)); fprintf(tabout, "/n");						fprintf(tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n", icol+CRIGHT, TMP, icol+CRIGHT, TMP);					}				}			}		}		if (acase[icol])		{			fprintf(tabout, ".if //n(%d>=//n(%d .nr %d //n(%du+2n/n",S2,icol+CRIGHT,icol+CRIGHT,S2);		}		if (doubled[icol])		{			fprintf(tabout, ".nr %d //n(%d/n", icol+CMID, S1);			fprintf(tabout, ".nr %d //n(%d+//n(%d/n",TMP,icol+CMID,S2);			fprintf(tabout, ".if //n(%d>//n(%d .nr %d //n(%d/n",TMP,icol+CRIGHT,icol+CRIGHT,TMP);			fprintf(tabout, ".if //n(%d<//n(%d .nr %d +(//n(%d-//n(%d)/2/n",TMP,icol+CRIGHT,icol+CMID,icol+CRIGHT,TMP);		}		if (cll[icol][0])		{			fprintf(tabout, ".nr %d %sn/n", TMP, cll[icol]);			fprintf(tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n",icol+CRIGHT, TMP, icol+CRIGHT, TMP);		}		for(ilin=0; ilin<nlin; ilin++)			if ((k=lspan(ilin, icol)))			{				s=table[ilin][icol-k].col;				if (!real(s) || barent(s) || vspen(s) ) continue;				fprintf(tabout, ".nr %d ", TMP);				wide(table[ilin][icol-k].col, FN(ilin,icol-k), SZ(ilin,icol-k));				for(ik=k; ik>=0; ik--)//.........这里部分代码省略.........
开发者ID:bapt,项目名称:heirloom-doctools,代码行数:101,


示例19: snapSess

boolStateSnapshot::writeHistoryBlocks() const{    std::unique_ptr<soci::session> snapSess(        mApp.getDatabase().canUsePool()            ? make_unique<soci::session>(mApp.getDatabase().getPool())            : nullptr);    soci::session& sess(snapSess ? *snapSess : mApp.getDatabase().getSession());    soci::transaction tx(sess);    // The current "history block" is stored in _three_ files, one just ledger    // headers, one TransactionHistoryEntry (which contain txSets) and    // one TransactionHistoryResultEntry containing transaction set results.    // All files are streamed out of the database, entry-by-entry.    XDROutputFileStream ledgerOut, txOut, txResultOut;    ledgerOut.open(mLedgerSnapFile->localPath_nogz());    txOut.open(mTransactionSnapFile->localPath_nogz());    txResultOut.open(mTransactionResultSnapFile->localPath_nogz());    // 'mLocalState' describes the LCL, so its currentLedger will usually be 63,    // 127, 191, etc. We want to start our snapshot at 64-before the _next_    // ledger: 0, 64, 128, etc. In cases where we're forcibly checkpointed    // early, we still want to round-down to the previous checkpoint ledger.    uint32_t begin = mApp.getHistoryManager().prevCheckpointLedger(        mLocalState.currentLedger);    uint32_t count = (mLocalState.currentLedger - begin) + 1;    CLOG(DEBUG, "History") << "Streaming " << count                           << " ledgers worth of history, from " << begin;    size_t nHeaders = LedgerHeaderFrame::copyLedgerHeadersToStream(        mApp.getDatabase(), sess, begin, count, ledgerOut);    size_t nTxs = TransactionFrame::copyTransactionsToStream(        mApp.getDatabase(), sess, begin, count, txOut, txResultOut);    CLOG(DEBUG, "History") << "Wrote " << nHeaders << " ledger headers to "                           << mLedgerSnapFile->localPath_nogz();    CLOG(DEBUG, "History") << "Wrote " << nTxs << " transactions to "                           << mTransactionSnapFile->localPath_nogz() << " and "                           << mTransactionResultSnapFile->localPath_nogz();    // When writing checkpoint 0x3f (63) we will have written 63 headers because    // header 0 doesn't exist, ledger 1 is the first. For all later checkpoints    // we will write 64 headers; any less and something went wrong[1].    //    // [1]: Probably our read transaction was serialized ahead of the write    // transaction composing the history itself, despite occurring in the    // opposite wall-clock order, this is legal behavior in SERIALIZABLE    // transaction-isolation level -- the highest offered! -- as txns only have    // to be applied in isolation and in _some_ order, not the wall-clock order    // we issued them. Anyway this is transient and should go away upon retry.    if (! ((begin == 0 && nHeaders == count - 1) ||           nHeaders == count))    {        CLOG(ERROR, "History") << "Only wrote " << nHeaders << " ledger headers for "                               << mLedgerSnapFile->localPath_nogz() << ", expecting "                               << count;        return false;    }    return true;}
开发者ID:ligthyear,项目名称:stellar-core,代码行数:61,


示例20: i2c_rx_string

int i2c_rx_string(unsigned char addr, char* buf, int len) {  tx(1,0,addr << 1 | 1);  for(int i=0;i<len-1;i++) buf[i]=rx(0,0);  buf[len-1]=rx(1,1);  return 0;}
开发者ID:rghunter,项目名称:LoggoDAQ,代码行数:6,


示例21: refresh

voidTPIO::refreshOldPages(page_id_t threshold, size_t pgsPerTx){	// rOP: refreshOldPages	//	// case 1:	//    rOP    s---e	//    Rebase       s---e	//	//    no prob	//	// case 2:	//    rOP          s---e	//    Rebase s---e      s---e	//	//    no prob	//	// case 3:	//    rOP        s-!---e	//    Rebase s-----e	//	//    no prob. rOP waits until rebase is done	//	// case 4:	//    rOP    s---e	//    Rebase   s-!---e	//	//    rebase need to wait until rOP finishes... BAD!	//	if(m_bDuringRefresh)	{		std::cout << "already during refresh" << std::endl;		return; 	}	PTNK_MEMBARRIER_COMPILER;	if(! PTNK_CAS(&m_bDuringRefresh, false, true))	{		std::cout << "already during refresh (CAS failed)" << std::endl;		return;	}	PTNK_MEMBARRIER_COMPILER;#ifdef VERBOSE_REFRESH	std::cout << "refresh start" << std::endl << *this;#endif		void* cursor = NULL;	do	{		unique_ptr<TPIOTxSession> tx(newTransaction());		Page pgStart(tx->readPage(tx->pgidStartPage()));				pgStart.refreshAllLeafPages(&cursor, threshold, pgsPerTx, tx.get());#ifdef VERBOSE_REFRESH		tx->dumpStat();#endif		if(! tryCommit(tx.get(), COMMIT_REFRESH))		{			std::cerr << "refresh ci failed!" << std::endl;			}	}	while(cursor);	PTNK_MEMBARRIER_COMPILER;	m_bDuringRefresh = false;#ifdef VERBOSE_REFRESH	std::cout << "refresh end" << std::endl << *this;#endif	rebase(/* force = */ true);}
开发者ID:nyaxt,项目名称:ptnk,代码行数:75,


示例22: i2c_tx_string

int i2c_tx_string(unsigned char addr, char* buf, int len) {  tx(1,0,addr << 1 | 0);  for(int i=0;i<len-1;i++) tx(0,0,buf[i]);  tx(0,1,buf[len-1]);  return 0;}
开发者ID:rghunter,项目名称:LoggoDAQ,代码行数:6,


示例23: tx

CMUK_ERROR_CODE cmuk::computeStanceDK( const vec3f& body_pos,                                       const quatf& body_rot,                                       const vec3f& body_vel,                                       const vec3f& body_angvel,                                       const StanceIKMode fmode[4],                                       const vec3f fpos[4],                                       const vec3f fvel[4],                                       DState* state,                                       int errflags[4] ) const {  if (!state) {    return CMUK_INSUFFICIENT_ARGUMENTS;  }  Transform3f tx(body_rot, body_pos);  state->body_pos = body_pos;  state->body_rot = body_rot;  state->body_vel = body_vel;  state->body_angvel = body_angvel;  mat3f j(false), jinv(false);  CMUK_ERROR_CODE rval = CMUK_OKAY;   for (int i=0; i<4; ++i) {    errflags[i] = 0;    if (fmode[i] == STANCE_IK_IGNORE) {      continue;    }    LegIndex leg = LegIndex(i);    vec3f pos;    if (fmode[i] == STANCE_IK_BODY) {      pos = fpos[i];    } else {      pos = tx.transformInv(fpos[i]);    }    vec3f q;    CMUK_ERROR_CODE status = computePreferredFootIK(leg, pos, &q);    state->leg_rot[i] = q;    // couldn't exactly get there    if (status != CMUK_OKAY) {       errflags[i] = (errflags[i] | STANCE_ERR_UNREACHABLE);      // No IK -- zero out velocity and set rval      if (rval == CMUK_OKAY || rval == CMUK_SINGULAR_MATRIX) {         rval = status;      }      quatf ignore;      computeFootFK(leg, q, &pos, &ignore);    }    // relative velocity of foot in rotating body frame    vec3f rvel;    if (fmode[i] == STANCE_IK_BODY) {      rvel = fvel[i];    } else {      // foot offset in world frame      vec3f r = tx.transformFwd(pos) - body_pos;      // foot velocity in world frame due to body if no joint movement      vec3f fvel_w = body_vel + vec3f::cross(body_angvel, r);                // rel velocity in world frame      vec3f fvel_rel_w = fvel[i] - fvel_w;            // rel velocity in body frame      // TODO: double-check whether this is fwd or inv?      rvel = tx.rotFwd() * fvel_rel_w;    }    computeFootDK(leg, q, &j);    status = computeDKInverse(j, &jinv);    state->leg_rotvel[i] = jinv * rvel;    // if jacobian was singular, make a note of it    if (status != CMUK_OKAY) {      errflags[i] = (errflags[i] | STANCE_ERR_SINGULAR);      if (rval == CMUK_OKAY) { rval = status; }    }  }  return rval;}
开发者ID:swatbotics,项目名称:darwin,代码行数:100,


示例24: main

int main(int argc, char **argv) {    ECCVerifyHandle globalVerifyHandle;    std::vector<char> buffer;    if (!read_stdin(buffer)) return 0;    if (buffer.size() < sizeof(uint32_t)) return 0;    uint32_t test_id = 0xffffffff;    memcpy(&test_id, &buffer[0], sizeof(uint32_t));    buffer.erase(buffer.begin(), buffer.begin() + sizeof(uint32_t));    if (test_id >= TEST_ID_END) return 0;    CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);    try {        int nVersion;        ds >> nVersion;        ds.SetVersion(nVersion);    } catch (const std::ios_base::failure &e) {        return 0;    }    switch (test_id) {        case CBLOCK_DESERIALIZE: {            try {                CBlock block;                ds >> block;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CTRANSACTION_DESERIALIZE: {            try {                CTransaction tx(deserialize, ds);            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CBLOCKLOCATOR_DESERIALIZE: {            try {                CBlockLocator bl;                ds >> bl;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CBLOCKMERKLEROOT: {            try {                CBlock block;                ds >> block;                bool mutated;                BlockMerkleRoot(block, &mutated);            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CADDRMAN_DESERIALIZE: {            try {                CAddrMan am;                ds >> am;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CBLOCKHEADER_DESERIALIZE: {            try {                CBlockHeader bh;                ds >> bh;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CBANENTRY_DESERIALIZE: {            try {                CBanEntry be;                ds >> be;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CTXUNDO_DESERIALIZE: {            try {                CTxUndo tu;                ds >> tu;            } catch (const std::ios_base::failure &e) {                return 0;            }            break;        }        case CBLOCKUNDO_DESERIALIZE: {            try {                CBlockUndo bu;                ds >> bu;//.........这里部分代码省略.........
开发者ID:a7853z,项目名称:bitcoin-abc,代码行数:101,


示例25: connect

void Link::lockUser(void){	connect(this, SIGNAL(error()), this, SLOT(stopSignals()));	tx("user[" + employee->getID() + "].lock=" + QString::number(employee->getVersion()) + "/n");}
开发者ID:jbagg,项目名称:vactracker,代码行数:5,


示例26: main

int main(int argc, char *argv[]){    int s1 = -1, s2 = -1, ret = -1;    struct ifreq ifr;    int ifindex1, ifindex2;    struct sockaddr_ll ll;    fd_set rfds;    struct timeval tv;    struct rx_result res;    if (argc != 3) {        fprintf(stderr, "usage: hwsim_test <ifname1> <ifname2>/n");        return -1;    }    memset(bcast, 0xff, ETH_ALEN);    s1 = socket(PF_PACKET, SOCK_RAW, htons(HWSIM_ETHERTYPE));    if (s1 < 0) {        perror("socket");        goto fail;    }    s2 = socket(PF_PACKET, SOCK_RAW, htons(HWSIM_ETHERTYPE));    if (s2 < 0) {        perror("socket");        goto fail;    }    memset(&ifr, 0, sizeof(ifr));    strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name));    if (ioctl(s1, SIOCGIFINDEX, &ifr) < 0) {        perror("ioctl[SIOCGIFINDEX]");        goto fail;    }    ifindex1 = ifr.ifr_ifindex;    if (ioctl(s1, SIOCGIFHWADDR, &ifr) < 0) {        perror("ioctl[SIOCGIFHWADDR]");        goto fail;    }    memcpy(addr1, ifr.ifr_hwaddr.sa_data, ETH_ALEN);    memset(&ifr, 0, sizeof(ifr));    strncpy(ifr.ifr_name, argv[2], sizeof(ifr.ifr_name));    if (ioctl(s2, SIOCGIFINDEX, &ifr) < 0) {        perror("ioctl[SIOCGIFINDEX]");        goto fail;    }    ifindex2 = ifr.ifr_ifindex;    if (ioctl(s2, SIOCGIFHWADDR, &ifr) < 0) {        perror("ioctl[SIOCGIFHWADDR]");        goto fail;    }    memcpy(addr2, ifr.ifr_hwaddr.sa_data, ETH_ALEN);    memset(&ll, 0, sizeof(ll));    ll.sll_family = PF_PACKET;    ll.sll_ifindex = ifindex1;    ll.sll_protocol = htons(HWSIM_ETHERTYPE);    if (bind(s1, (struct sockaddr *) &ll, sizeof(ll)) < 0) {        perror("bind");        goto fail;    }    memset(&ll, 0, sizeof(ll));    ll.sll_family = PF_PACKET;    ll.sll_ifindex = ifindex2;    ll.sll_protocol = htons(HWSIM_ETHERTYPE);    if (bind(s2, (struct sockaddr *) &ll, sizeof(ll)) < 0) {        perror("bind");        goto fail;    }    tx(s1, argv[1], ifindex1, addr1, addr2);    tx(s1, argv[1], ifindex1, addr1, bcast);    tx(s2, argv[2], ifindex2, addr2, addr1);    tx(s2, argv[2], ifindex2, addr2, bcast);    tv.tv_sec = 1;    tv.tv_usec = 0;    memset(&res, 0, sizeof(res));    for (;;) {        int r;        FD_ZERO(&rfds);        FD_SET(s1, &rfds);        FD_SET(s2, &rfds);        r = select(s2 + 1, &rfds, NULL, NULL, &tv);        if (r < 0) {            perror("select");            goto fail;        }        if (r == 0)            break; /* timeout */        if (FD_ISSET(s1, &rfds))            rx(s1, 1, argv[1], ifindex1, &res);        if (FD_ISSET(s2, &rfds))//.........这里部分代码省略.........
开发者ID:resfi,项目名称:resfi,代码行数:101,


示例27: stopSignals

void Link::unlockUser(void){	stopSignals();	tx("user[" + employee->getID() + "].unlock/n");}
开发者ID:jbagg,项目名称:vactracker,代码行数:5,


示例28: main

int main(int argc, char **argv){	int c, option_index;	if (argc < 2)		print_help(argv[0], -1);	while (1) {		option_index = 0;		c = getopt_long(argc, argv,#if PCIMAXFM_ENABLE_TX_TOGGLE				"t::"#endif /* PCIMAXFM_ENABLE_TX_TOGGLE */				"f::p::s::"#if PCIMAXFM_ENABLE_RDS#if PCIMAXFM_ENABLE_RDS_TOGGLE				"g::"#endif /* PCIMAXFM_ENABLE_RDS_TOGGLE */				"r:"#endif /* PCIMAXFM_ENABLE_RDS */				"d::vqehH",				long_options, &option_index);		if (c == -1)			break;		switch (c) {#if PCIMAXFM_ENABLE_TX_TOGGLE			case 't':				tx(optarg);				break;#endif /* PCIMAXFM_ENABLE_TX_TOGGLE */			case 'f':				freq(optarg);				break;			case 'p':				power(optarg);				break;			case 's':				stereo(optarg);				break;#if PCIMAXFM_ENABLE_RDS#if PCIMAXFM_ENABLE_RDS_TOGGLE			case 'g':				rds_signal(optarg);				break;#endif /* PCIMAXFM_ENABLE_RDS_TOGGLE */			case 'r':				rds(optarg);				break;#endif /* PCIMAXFM_ENABLE_RDS */			case 'd':				device(optarg);				break;			case 'v':				verbosity = 1;				DEBUG_MSG("Verbose output.");				break;			case 'q':				verbosity = -1;				break;			case 'e':				print_version(argv[0]);			case 'h':				print_help(argv[0], 0);#if PCIMAXFM_ENABLE_RDS			case 'H':				print_help_rds(0);#endif /* PCIMAXFM_ENABLE_RDS */			default:				exit(1);		}	}	dev_close();	return 0;}
开发者ID:dterweij,项目名称:pcimaxfm,代码行数:79,


示例29: tx

void FORTE_FB_FT_TN64::alg_checkTime(void){tx() = TIME();}
开发者ID:EstebanQuerol,项目名称:Black_FORTE,代码行数:3,


示例30: maktab

voidmaktab(void)			/* define the tab stops of the table */{	int	icol, ilin, tsep, k, ik, vforml, il, s, text;	char	*ss;	for (icol = 0; icol < ncol; icol++) {		doubled[icol] = acase[icol] = 0;		Bprint(&tabout, ".nr %2s 0/n", reg(icol, CRIGHT));		for (text = 0; text < 2; text++) {			if (text)				Bprint(&tabout, ".%2s/n.rm %2s/n", reg(icol, CRIGHT),				    reg(icol, CRIGHT));			for (ilin = 0; ilin < nlin; ilin++) {				if (instead[ilin] || fullbot[ilin]) 					continue;				vforml = ilin;				for (il = prev(ilin); il >= 0 && vspen(table[il][icol].col); il = prev(il))					vforml = il;				if (fspan(vforml, icol)) 					continue;				if (filler(table[ilin][icol].col)) 					continue;				if ((flags[icol][stynum[ilin]] & ZEROW) != 0) 					continue;				switch (ctype(vforml, icol)) {				case 'a':					acase[icol] = 1;					ss = table[ilin][icol].col;					s = (int)(uintptr)ss;					if (s > 0 && s < 128 && text) {						if (doubled[icol] == 0)							Bprint(&tabout, ".nr %d 0/n.nr %d 0/n",							    S1, S2);						doubled[icol] = 1;						Bprint(&tabout, ".if //n(%c->//n(%d .nr %d //n(%c-/n",						    s, S2, S2, (int)s);					}				case 'n':					if (table[ilin][icol].rcol != 0) {						if (doubled[icol] == 0 && text == 0)							Bprint(&tabout, ".nr %d 0/n.nr %d 0/n",							    S1, S2);						doubled[icol] = 1;						if (real(ss = table[ilin][icol].col) && !vspen(ss)) {							s = (int)(uintptr)ss;							if (tx(s) != text) 								continue;							Bprint(&tabout, ".nr %d ", TMP);							wide(ss, FN(vforml, icol), SZ(vforml, icol)); 							Bprint(&tabout, "/n");							Bprint(&tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n",							    S1, TMP, S1, TMP);						}						if (text == 0 && real(ss = table[ilin][icol].rcol) && !vspen(ss) && !barent(ss)) {							Bprint(&tabout, ".nr %d //w%c%s%c/n",							    TMP, F1, ss, F1);							Bprint(&tabout, ".if //n(%d<//n(%d .nr %d //n(%d/n", S2, TMP, S2,							     TMP);						}						continue;					}				case 'r':				case 'c':				case 'l':					if (real(ss = table[ilin][icol].col) && !vspen(ss)) {						s = (int)(uintptr)ss;						if (tx(s) != text) 							continue;						Bprint(&tabout, ".nr %d ", TMP);						wide(ss, FN(vforml, icol), SZ(vforml, icol)); 						Bprint(&tabout, "/n");						Bprint(&tabout, ".if //n(%2s<//n(%d .nr %2s //n(%d/n",						     reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);					}				}			}		}		if (acase[icol]) {			Bprint(&tabout, ".if //n(%d>=//n(%2s .nr %2s //n(%du+2n/n", 			     S2, reg(icol, CRIGHT), reg(icol, CRIGHT), S2);		}		if (doubled[icol]) {			Bprint(&tabout, ".nr %2s //n(%d/n", reg(icol, CMID), S1);			Bprint(&tabout, ".nr %d //n(%2s+//n(%d/n", TMP, reg(icol, CMID), S2);			Bprint(&tabout, ".if //n(%d>//n(%2s .nr %2s //n(%d/n", TMP,			    reg(icol, CRIGHT), reg(icol, CRIGHT), TMP);			Bprint(&tabout, ".if //n(%d<//n(%2s .nr %2s +(//n(%2s-//n(%d)/2/n",			     TMP, reg(icol, CRIGHT), reg(icol, CMID), reg(icol, CRIGHT), TMP);		}		if (cll[icol][0]) {			Bprint(&tabout, ".nr %d %sn/n", TMP, cll[icol]);			Bprint(&tabout, ".if //n(%2s<//n(%d .nr %2s //n(%d/n",			    reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);		}		for (ilin = 0; ilin < nlin; ilin++)			if (k = lspan(ilin, icol)) {				ss = table[ilin][icol-k].col;				if (!real(ss) || barent(ss) || vspen(ss) ) 					continue;//.........这里部分代码省略.........
开发者ID:Earnestly,项目名称:plan9,代码行数:101,



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


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