当前位置: 首页>>代码示例>>C++>>正文


C++ Op函数代码示例

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


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


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