• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Op函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_machine

int test_machine() {
   Machine m;

   Instr instr1;
   instr1.o = Op(OpType::MOV, OpLayout::MC).op;
   instr1.mc.a = 10;
   instr1.mc.c = 16;
   m.mem[1] = instr1.uint64;

   Instr instr2;
   instr2.o = Op(OpType::MOV, OpLayout::RC).op;
   instr2.rc.r = 1;
   instr2.rc.c = 16;
   m.mem[2] = instr2.uint64;

   Instr instr3;
   instr3.o = Op(OpType::INT, OpLayout::C).op;
   instr3.c = 2;
   m.mem[3] = instr3.uint64;

   Instr instr10;
   instr10.o = Op(OpType::HALT, OpLayout::NONE).op;
   m.mem[4] = instr10.uint64;

   m.run();

   //cout << m.r[0] << "\n";
   //cout << m.mem[5] << "\n";

   //char c = getch();
   //testOp();
}
开发者ID:rpasta42,项目名称:bug-finesser,代码行数:32,代码来源:main.cpp


示例2: Op

cTCPLink::cCallbacksPtr cLuaServerHandle::OnIncomingConnection(const AString & a_RemoteIPAddress, UInt16 a_RemotePort)
{
	// If not valid anymore, drop the connection:
	if (!m_Callbacks.IsValid())
	{
		return nullptr;
	}

	// Ask the plugin for link callbacks:
	cPluginLua::cOperation Op(m_Plugin);
	cLuaState::cRef LinkCallbacks;
	if (
		!Op().Call(cLuaState::cTableRef(m_Callbacks, "OnIncomingConnection"), a_RemoteIPAddress, a_RemotePort, m_Port, cLuaState::Return, LinkCallbacks) ||
		!LinkCallbacks.IsValid()
	)
	{
		LOGINFO("cNetwork server (port %d) OnIncomingConnection callback failed in plugin %s. Dropping connection.",
			m_Port, m_Plugin.GetName().c_str()
		);
		return nullptr;
	}

	// Create the link wrapper to use with the callbacks:
	auto res = std::make_shared<cLuaTCPLink>(m_Plugin, std::move(LinkCallbacks), m_Self);

	// Add the link to the list of our connections:
	cCSLock Lock(m_CSConnections);
	m_Connections.push_back(res);

	return res;
}
开发者ID:1285done,项目名称:cuberite,代码行数:31,代码来源:LuaServerHandle.cpp


示例3: properties

void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) {
    if (properties().getAlpha() <= 0.0f
            || properties().getOutline().getAlpha() <= 0.0f
            || !properties().getOutline().getPath()
            || properties().getScaleX() == 0
            || properties().getScaleY() == 0) {
        // no shadow to draw
        return;
    }

    mat4 shadowMatrixXY(transformFromParent);
    applyViewPropertyTransforms(shadowMatrixXY);

    // Z matrix needs actual 3d transformation, so mapped z values will be correct
    mat4 shadowMatrixZ(transformFromParent);
    applyViewPropertyTransforms(shadowMatrixZ, true);

    const SkPath* casterOutlinePath = properties().getOutline().getPath();
    const SkPath* revealClipPath = properties().getRevealClip().getPath();
    if (revealClipPath && revealClipPath->isEmpty()) return;

    float casterAlpha = properties().getAlpha() * properties().getOutline().getAlpha();


    // holds temporary SkPath to store the result of intersections
    SkPath* frameAllocatedPath = nullptr;
    const SkPath* outlinePath = casterOutlinePath;

    // intersect the outline with the reveal clip, if present
    if (revealClipPath) {
        frameAllocatedPath = handler.allocPathForFrame();

        Op(*outlinePath, *revealClipPath, kIntersect_SkPathOp, frameAllocatedPath);
        outlinePath = frameAllocatedPath;
    }

    // intersect the outline with the clipBounds, if present
    if (properties().getClippingFlags() & CLIP_TO_CLIP_BOUNDS) {
        if (!frameAllocatedPath) {
            frameAllocatedPath = handler.allocPathForFrame();
        }

        Rect clipBounds;
        properties().getClippingRectForFlags(CLIP_TO_CLIP_BOUNDS, &clipBounds);
        SkPath clipBoundsPath;
        clipBoundsPath.addRect(clipBounds.left, clipBounds.top,
                clipBounds.right, clipBounds.bottom);

        Op(*outlinePath, clipBoundsPath, kIntersect_SkPathOp, frameAllocatedPath);
        outlinePath = frameAllocatedPath;
    }

    DisplayListOp* shadowOp  = new (handler.allocator()) DrawShadowOp(
            shadowMatrixXY, shadowMatrixZ, casterAlpha, outlinePath);
    handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds());
}
开发者ID:rockinroyle,项目名称:platform_frameworks_base,代码行数:56,代码来源:RenderNode.cpp


示例4: numSuccs

/**
 * Return the number of successor-edges including fall-through paths but not
 * implicit exception paths.
 */
int numSuccs(const Opcode* instr) {
  if (!instrIsControlFlow(*instr)) return 1;
  if ((instrFlags(*instr) & TF) != 0) {
    if (Op(*instr) == OpSwitch) return *(int*)(instr + 1);
    if (Op(*instr) == OpJmp) return 1;
    return 0;
  }
  if (instrJumpOffset(const_cast<Opcode*>(instr))) return 2;
  return 1;
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:14,代码来源:hhbc.cpp


示例5: switch

bool SceneEditorVP::DoNotify(const ork::event::Event* pev)
{
	const ork::ent::SceneInstEvent* sei = ork::rtti::autocast(pev);

	if(sei)
	{
		switch(sei->GetEvent())
		{
			case ork::ent::SceneInstEvent::ESIEV_DISABLE_UPDATE:
			{	auto lamb = [=]() 
				{	gUpdateStatus.SetState(EUPD_STOP);
				};
				Op(lamb).QueueASync(UpdateSerialOpQ());
				break;
			}
			case ork::ent::SceneInstEvent::ESIEV_ENABLE_UPDATE:
			{	auto lamb = [=]() 
				{	gUpdateStatus.SetState(EUPD_START);
				};
				Op(lamb).QueueASync(UpdateSerialOpQ());
				break;
			}
			case ork::ent::SceneInstEvent::ESIEV_DISABLE_VIEW:
			{	auto lamb = [=]() 
				{	this->DisableSceneDisplay();
					//#disable path that would lead to gfx globallock
					//# maybe show a "loading" screen or something
				};
				Op(lamb).QueueASync(MainThreadOpQ());
				//mDbLock.ReleaseCurrent();
				break;
			}
			case ork::ent::SceneInstEvent::ESIEV_ENABLE_VIEW:
			{	auto lamb = [=]() 
				{	this->EnableSceneDisplay();
					//#disable path that would lead to gfx globallock
					//# maybe show a "loading" screen or something
				};
				Op(lamb).QueueASync(MainThreadOpQ());
				//mDbLock.ReleaseCurrent();
				break;
			}
			case ork::ent::SceneInstEvent::ESIEV_BIND:
				//mDbLock.ReleaseCurrent();
				break;
			case ork::ent::SceneInstEvent::ESIEV_START:
				break;
			case ork::ent::SceneInstEvent::ESIEV_STOP:
				break;
			case ork::ent::SceneInstEvent::ESIEV_USER:
				break;
		}
	}
	return false;
}
开发者ID:tweakoz,项目名称:orkid,代码行数:55,代码来源:qtvp_sceneupdate.cpp


示例6: file_size_

TestRPCServerMRC::TestRPCServerMRC() : file_size_(1024 * 1024) {
  interface_id_ = INTERFACE_ID_MRC;
  // Register available operations.
  operations_[PROC_ID_OPEN] = Op(this, &TestRPCServerMRC::OpenOperation);
  operations_[PROC_ID_XTREEMFS_RENEW_CAPABILITY] =
      Op(this, &TestRPCServerMRC::RenewCapabilityOperation);
  operations_[PROC_ID_XTREEMFS_UPDATE_FILE_SIZE] =
      Op(this, &TestRPCServerMRC::UpdateFileSizeOperation);
  operations_[PROC_ID_FTRUNCATE] =
      Op(this, &TestRPCServerMRC::FTruncate);
}
开发者ID:BillTheBest,项目名称:xtreemfs,代码行数:11,代码来源:test_rpc_server_mrc.cpp


示例7: m_Plugin

cLuaTCPLink::cLuaTCPLink(cPluginLua & a_Plugin, int a_CallbacksTableStackPos):
	m_Plugin(a_Plugin),
	m_Callbacks(cPluginLua::cOperation(a_Plugin)(), a_CallbacksTableStackPos)
{
	// Warn if the callbacks aren't valid:
	if (!m_Callbacks.IsValid())
	{
		LOGWARNING("cTCPLink in plugin %s: callbacks could not be retrieved", m_Plugin.GetName().c_str());
		cPluginLua::cOperation Op(m_Plugin);
		Op().LogStackTrace();
	}
}
开发者ID:GoogleIt15973,项目名称:cuberite,代码行数:12,代码来源:LuaTCPLink.cpp


示例8: Make_edge

edge *Join(edge *a, point *u, edge *b, point *v, int side) {
	edge *e = Make_edge(u, v);
	if (side == 1) {
		if (Oi(a) == u) Splice(Op(a), e, u);
		else Splice(Dp(a), e, u);
		Splice(b, e, v);
	} else {
		Splice(a, e, u);
		if (Oi(b) == v) Splice(Op(b), e, v);
		else Splice(Dp(b), e, v);
	} return e;
}
开发者ID:bywbilly,项目名称:Templates,代码行数:12,代码来源:Voronoi.cpp


示例9: Op

TestRPCServerDIR::TestRPCServerDIR() {
  interface_id_ = INTERFACE_ID_DIR;
  // Register available operations.

  operations_[PROC_ID_XTREEMFS_SERVICE_GET_BY_NAME]
      = Op(this, &TestRPCServerDIR::GetServiceByNameOperation);
  operations_[PROC_ID_XTREEMFS_SERVICE_GET_BY_UUID]
      = Op(this, &TestRPCServerDIR::GetServiceByUUIDOperation);
  operations_[PROC_ID_XTREEMFS_ADDRESS_MAPPINGS_GET]
      = Op(this, &TestRPCServerDIR::GetAddressMappingOperation);

}
开发者ID:amokoma,项目名称:xtreemfs,代码行数:12,代码来源:test_rpc_server_dir.cpp


示例10: ASSERT

bool cLuaChunkStay::AddChunks(int a_ChunkCoordTableStackPos)
{
	// This function is expected to be called just once, with all the coords in a table
	ASSERT(m_Chunks.empty());
	
	cPluginLua::cOperation Op(m_Plugin);
	cLuaState & L = Op();
	
	// Check that we got a table:
	if (!lua_istable(L, a_ChunkCoordTableStackPos))
	{
		LOGWARNING("%s: The parameter is not a table of coords (got %s). Ignoring the call.",
			__FUNCTION__, lua_typename(L, lua_type(L, a_ChunkCoordTableStackPos))
		);
		L.LogStackTrace();
		return false;
	}
	
	// Add each set of coords:
	int NumChunks = luaL_getn(L, a_ChunkCoordTableStackPos);
	m_Chunks.reserve((size_t)NumChunks);
	for (int idx = 1; idx <= NumChunks; idx++)
	{
		// Push the idx-th element of the array onto stack top, check that it's a table:
		lua_rawgeti(L, a_ChunkCoordTableStackPos, idx);
		if (!lua_istable(L, -1))
		{
			LOGWARNING("%s: Element #%d is not a table (got %s). Ignoring the element.",
				__FUNCTION__, idx, lua_typename(L, -1)
			);
			L.LogStackTrace();
			lua_pop(L, 1);
			continue;
		}
		AddChunkCoord(L, idx);
		lua_pop(L, 1);
	}
	
	// If there are no chunks, log a warning and return failure:
	if (m_Chunks.empty())
	{
		LOGWARNING("%s: Zero chunks to stay.", __FUNCTION__);
		L.LogStackTrace();
		return false;
	}
	
	// All ok
	return true;
}
开发者ID:Dam63,项目名称:MCServer,代码行数:49,代码来源:LuaChunkStay.cpp


示例11: Op

void cLuaTCPLink::ReceivedCleartextData(const char * a_Data, size_t a_NumBytes)
{
	// Check if we're still valid:
	if (!m_Callbacks.IsValid())
	{
		return;
	}

	// Call the callback:
	cPluginLua::cOperation Op(m_Plugin);
	if (!Op().Call(cLuaState::cTableRef(m_Callbacks, "OnReceivedData"), this, AString(a_Data, a_NumBytes)))
	{
		LOGINFO("cTCPLink OnReceivedData callback failed in plugin %s.", m_Plugin.GetName().c_str());
	}
}
开发者ID:GoogleIt15973,项目名称:cuberite,代码行数:15,代码来源:LuaTCPLink.cpp


示例12: Op

bool cLuaChunkStay::OnAllChunksAvailable(void)
{
	{
		// Call the callback:
		cPluginLua::cOperation Op(m_Plugin);
		Op().Call((int)m_OnAllChunksAvailable);
		
		// Remove the callback references - they won't be needed anymore
		m_OnChunkAvailable.UnRef();
		m_OnAllChunksAvailable.UnRef();
	}
	
	// Disable the ChunkStay by returning true
	return true;
}
开发者ID:Dam63,项目名称:MCServer,代码行数:15,代码来源:LuaChunkStay.cpp


示例13: pop

    void pop() {
        key[heap[1].first] = 0;
        heap[1] = heap[sz--];
        if (sz == 0) return;

        key[heap[1].first] = 1;
        for (int pos=1, c; (c=pos<<1) <= sz; pos=c) {
            if (c<sz && Op()(heap[c+1].second, heap[c].second)) ++c;
            if (Op()(heap[c].second, heap[pos].second)) {
                std::swap(heap[c], heap[pos]);
                key[heap[c].first] = c;
                key[heap[pos].first] = pos;
            }
            else break;
        }
    }
开发者ID:bradelement,项目名称:coding_exercise,代码行数:16,代码来源:1298_dijkstra_MBH.cpp


示例14: switch

void Parser::Expp()
{
	switch(look.kind)
	{
	case LT:
	case TIMES:
	case PLUS:
	case OR:
	case AND:
	case GT:
	case EQ:
	case MINUS:
	case DIV: Op();Exp();Expp();return;
	case LBRACK: Match(LBRACK);Exp();Match(RBRACK);Expp();return;
	case DOT: Match(DOT);
		switch(look.kind)
		{
		case LENGTH:Match(LENGTH);Expp();return;
		case ID: Id();Match(LPAREN);ExpList();Match(RPAREN);Expp();
		default: return;
		}
	case RPAREN:
	case SEMICOLON: return;	
	}
}
开发者ID:feimengspirit,项目名称:compiler,代码行数:25,代码来源:Parser.cpp


示例15: iter

bool SkClipStack::asPath(SkPath *path) const {
    bool isAA = false;

    path->reset();
    path->setFillType(SkPath::kInverseEvenOdd_FillType);

    SkClipStack::Iter iter(*this, SkClipStack::Iter::kBottom_IterStart);
    while (const SkClipStack::Element* element = iter.next()) {
        SkPath operand;
        if (element->getType() != SkClipStack::Element::kEmpty_Type) {
            element->asPath(&operand);
        }

        SkRegion::Op elementOp = element->getOp();
        if (elementOp == SkRegion::kReplace_Op) {
            *path = operand;
        } else {
            Op(*path, operand, (SkPathOp)elementOp, path);
        }

        // if the prev and curr clips disagree about aa -vs- not, favor the aa request.
        // perhaps we need an API change to avoid this sort of mixed-signals about
        // clipping.
        isAA = (isAA || element->isAA());
    }

    return isAA;
}
开发者ID:sylvestre,项目名称:skia,代码行数:28,代码来源:SkClipStack.cpp


示例16: CheckResults

    void CheckResults(const TestDatum &test,
                      ib_status_t rc,
                      ib_flags_t result)
    {
        const TextBuf &exout = ExpectedOut(test);
        bool exmod = (exout != test.InBuf());

        ib_flags_t exresult = ExpectedResult( Op(), exmod );

        CheckResult(test.LineNo(), test, rc, exresult, result);

        const char *out = m_outbuf.GetBuf();
        if (out != NULL) {
            size_t outlen = m_outbuf.GetLen();
            size_t exlen = exout.GetLen();
            EXPECT_EQ(exlen, outlen)
                << "Line " << test.LineNo() << ": " << Stringize(test)
                << " expected len=" << exlen
                << ", actual len=" << outlen;
            EXPECT_TRUE(exout == m_outbuf)
                << "Line " << test.LineNo() << ": " << Stringize(test)
                << " expected=\"" << exout.GetFmt() << "\""
                << " actual=\""   << m_outbuf.GetFmt() << "\"";
        }
    }
开发者ID:aburan28,项目名称:ironbee,代码行数:25,代码来源:test_util_string_wspc.cpp


示例17: cfuncall

static
int cfuncall (const double kc, const double c[], double f[], void *params) // calculate all components simultaneously
{
	size_t n,m,q;
	const size_t NB=model->total_bands;
    const size_t N2=NB*NB;
    
    const odeparams pars = * (odeparams *) params;
    const ThreeVector dir = pars.dir;
    
    complex double * cc = (complex double*) c;
    complex double * fc = (complex double*) f;
    
    // calculate matrix elements from c[]

    ThreeVector k = dir;
    three_vector_scale(&k,kc);
    if (!pars.pos)
        three_vector_scale(&k,-1.0);
    three_vector_incr(&k,&pars.kperp);
    
    if(fabs(dir.x[0])>1e-5*three_vector_length(&dir)) {
      model->dHdx (dHx, &k);
    }
    if(fabs(dir.x[1])>1e-5*three_vector_length(&dir)) {
      model->dHdy (dHy, &k);
    }
    if(fabs(dir.x[2])>1e-5*three_vector_length(&dir)) {
      model->dHdz (dHz, &k);
    }

    three_vector_array_project_inplace ((double*) wc, (double *) dHx, (double *) dHy, (double *) dHz, &dir, 2*N2);
    
    complex double *W = model->buffer1;
    complex_array_zero(W,N2);
    matrix_transform (W, cc, wc, NB);
    
    memset(f, 0, sizeof(double)*(2*N2+NB));

    for (n=0;n<NB;n++) {
        Op(n) = creal(W[n+n*NB]);
    }
    for (n=0;n<NB;n++) {
        for (q=0;q<NB;q++) {
            double omegadiff=O(n)-O(q);
            if (fabs(omegadiff)>1e-11) {  // was 1e-12
                complex double aa = W[q*NB+n]/omegadiff;
                for (m=0;m<NB;m++) {
                    F(m,n)+=aa*C(m,q);
                }
            }
        }
    }
    if (!pars.pos)
        for (m=0;m<2*N2+NB;m++)
        	f[m]=-f[m];
        
	return GSL_SUCCESS;
}
开发者ID:jwahlstrand,项目名称:kdotp-fke,代码行数:59,代码来源:coeffs-pert.c


示例18: Insert

 template <typename TIter> void Insert(TIter it, size_type n)
 {
   if (n != 0)
   {
     Op(INSERT, n);
     m_PatchWriter.WriteData(it, n);
   }
 }
开发者ID:DINKIN,项目名称:omim,代码行数:8,代码来源:diff.hpp


示例19: other

DoubleCRT& DoubleCRT::Op(const ZZX &poly, Fun fun)
{
  if (dryRun) return *this;

  const IndexSet& s = map.getIndexSet();
  DoubleCRT other(poly, context, s); // other defined wrt same primes as *this

  return Op(other, fun);
}
开发者ID:ElenaKirshanova,项目名称:HElib,代码行数:9,代码来源:DoubleCRT.cpp


示例20: draw

void draw(SkCanvas* canvas) {
    SkPaint paint;
    paint.setTextSize(80);
    SkPath path, path2;
    paint.getTextPath("ABC", 3, 20, 80, &path);
    path.offset(20, 20, &path2);
    Op(path, path2, SkPathOp::kDifference_SkPathOp, &path);
    path.addPath(path2);
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawPath(path, paint);
}
开发者ID:HalCanary,项目名称:skia-hc,代码行数:11,代码来源:Paint_getTextPath.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OpRead16函数代码示例发布时间:2022-05-30
下一篇:
C++ OnUpdate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap