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


C++ GetUID函数代码示例

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


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

示例1: CheckReceiveThreads

	// This function should be only ran when the temporary buffer size is not 0 (otherwise, data is copied directly to the threads)
	bool CheckReceiveThreads()
	{
		SortReceiveThreads();

		bool wokeThreads = false;
		bool freedSpace = false;
		while (!receiveWaitingThreads.empty() && GetUsedSize() > 0)
		{
			MsgPipeWaitingThread *thread = &receiveWaitingThreads.front();
			// Receive as much as possible, even if it's not enough to wake up.
			u32 bytesToSend = std::min(thread->freeSize, GetUsedSize());

			thread->WriteBuffer(Memory::GetPointer(buffer), bytesToSend);
			// Put the unused data at the start of the buffer.
			nmp.freeSize += bytesToSend;
			memmove(Memory::GetPointer(buffer), Memory::GetPointer(buffer) + bytesToSend, GetUsedSize());
			freedSpace = true;

			if (thread->waitMode == SCE_KERNEL_MPW_ASAP || thread->freeSize == 0)
			{
				thread->Complete(GetUID(), 0);
				receiveWaitingThreads.erase(receiveWaitingThreads.begin());
				wokeThreads = true;
				thread = NULL;
			}
			// Stop at the first that can't wake up.
			else
				break;
		}

		if (freedSpace)
			wokeThreads |= CheckSendThreads();

		return wokeThreads;
	}
开发者ID:PewnyPL,项目名称:ppsspp,代码行数:36,代码来源:sceKernelMsgPipe.cpp

示例2: CheckSendThreads

	bool CheckSendThreads()
	{
		SortSendThreads();

		bool wokeThreads = false;
		bool filledSpace = false;
		while (!sendWaitingThreads.empty() && nmp.freeSize > 0)
		{
			MsgPipeWaitingThread *thread = &sendWaitingThreads.front();
			u32 bytesToSend = std::min(thread->freeSize, (u32) nmp.freeSize);

			thread->ReadBuffer(Memory::GetPointer(buffer + GetUsedSize()), bytesToSend);
			nmp.freeSize -= bytesToSend;
			filledSpace = true;

			if (thread->waitMode == SCE_KERNEL_MPW_ASAP || thread->freeSize == 0)
			{
				thread->Complete(GetUID(), 0);
				sendWaitingThreads.erase(sendWaitingThreads.begin());
				wokeThreads = true;
				thread = NULL;
			}
			// Unlike receives, we don't do partial sends.  Stop at first blocked thread.
			else
				break;
		}

		if (filledSpace)
			wokeThreads |= CheckReceiveThreads();

		return wokeThreads;
	}
开发者ID:PewnyPL,项目名称:ppsspp,代码行数:32,代码来源:sceKernelMsgPipe.cpp

示例3: jack_shmalloc

/* allocate a POSIX shared memory segment */
int
jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
{
	jack_shm_registry_t* registry;
	int shm_fd;
	int rc = -1;
	char name[SHM_NAME_MAX+1];

	if (jack_shm_lock_registry () < 0) {
        jack_error ("jack_shm_lock_registry fails...");
        return -1;
    }

	if ((registry = jack_get_free_shm_info ()) == NULL) {
		jack_error ("shm registry full");
		goto unlock;
	}

	/* On Mac OS X, the maximum length of a shared memory segment
	 * name is SHM_NAME_MAX (instead of NAME_MAX or PATH_MAX as
	 * defined by the standard).  Unfortunately, Apple sets this
	 * value so small (about 31 bytes) that it is useless for
	 * actual names.  So, we construct a short name from the
	 * registry index for uniqueness and ignore the shm_name
	 * parameter.  Bah!
	 */
	snprintf (name, sizeof (name), "/jack-%d-%d", GetUID(), registry->index);

	if (strlen (name) >= sizeof (registry->id)) {
		jack_error ("shm segment name too long %s", name);
		goto unlock;
	}

	if ((shm_fd = shm_open (name, O_RDWR|O_CREAT, 0666)) < 0) {
		jack_error ("Cannot create shm segment %s (%s)",
			    name, strerror (errno));
		goto unlock;
	}

	if (ftruncate (shm_fd, size) < 0) {
		jack_error ("Cannot set size of engine shm "
			    "registry 0 (%s)",
			    strerror (errno));
		close (shm_fd);
		goto unlock;
	}

	close (shm_fd);
	registry->size = size;
	strncpy (registry->id, name, sizeof (registry->id));
	registry->allocator = GetPID();
	si->index = registry->index;
	si->ptr.attached_at = MAP_FAILED;	/* not attached */
	rc = 0;				/* success */

 unlock:
	jack_shm_unlock_registry ();
	return rc;
}
开发者ID:AndrewCooper,项目名称:jack2,代码行数:60,代码来源:shm.c

示例4: getNormalOfControlSurfaceDevice

PNamedShape CCPACSControlSurfaceDevice::getFlapShape()
{
    PNamedShape loft =  outerShape.GetLoft(
                _segment->GetWing().GetWingCleanShape(),
                getNormalOfControlSurfaceDevice());
    loft->SetName(GetUID().c_str());
    return loft;
}
开发者ID:DLR-SC,项目名称:tigl,代码行数:8,代码来源:CCPACSControlSurfaceDevice.cpp

示例5: SortThreads

	void SortThreads(std::vector<MsgPipeWaitingThread> &waitingThreads, bool usePrio)
	{
		// Clean up any not waiting at the same time.
		HLEKernel::CleanupWaitingThreads(WAITTYPE_MSGPIPE, GetUID(), waitingThreads);

		if (usePrio)
			std::stable_sort(waitingThreads.begin(), waitingThreads.end(), __KernelMsgPipeThreadSortPriority);
	}
开发者ID:libretro,项目名称:PSP1,代码行数:8,代码来源:sceKernelMsgPipe.cpp

示例6: ADDTOCALLSTACK

void CItemSpawn::AddObj(CGrayUID uid)
{
	ADDTOCALLSTACK("CitemSpawn:AddObj");
	// NOTE: This function is also called when loading spawn items
	// on server startup. In this case, some objs UID still invalid
	// (not loaded yet) so just proceed without any checks.

	bool bIsSpawnChar = IsType(IT_SPAWN_CHAR);
	if ( !g_Serv.IsLoading() )
	{
		if ( !uid.IsValidUID() )
			return;

		if ( bIsSpawnChar )				// IT_SPAWN_CHAR can only spawn NPCs
		{
			CChar *pChar = uid.CharFind();
			if ( !pChar || !pChar->m_pNPC )
				return;
		}
		else if ( !uid.ItemFind() )		// IT_SPAWN_ITEM can only spawn items
			return;

		CItemSpawn *pPrevSpawn = static_cast<CItemSpawn*>(uid.ObjFind()->m_uidSpawnItem.ItemFind());
		if ( pPrevSpawn )
		{
			if ( pPrevSpawn == this )		// obj already linked to this spawn
				return;
			pPrevSpawn->DelObj(uid);		// obj linked to other spawn, remove the link before proceed
		}
	}

	BYTE iMax = maximum(GetAmount(), 1);
	for (BYTE i = 0; i < iMax; i++ )
	{
		if ( !m_obj[i].IsValidUID() )
		{
			m_obj[i] = uid;
			m_currentSpawned++;

			// objects are linked to the spawn at each server start
			if ( !g_Serv.IsLoading() )
			{
				uid.ObjFind()->m_uidSpawnItem = GetUID();
				if ( bIsSpawnChar )
				{
					CChar *pChar = uid.CharFind();
					ASSERT(pChar->m_pNPC);
					pChar->StatFlag_Set(STATF_Spawned);
					pChar->m_ptHome = GetTopPoint();
					pChar->m_pNPC->m_Home_Dist_Wander = static_cast<WORD>(m_itSpawnChar.m_DistMax);
				}
			}
			break;
		}
	}
	if ( !g_Serv.IsLoading() )
		ResendTooltip();
}
开发者ID:DarkLotus,项目名称:Source,代码行数:58,代码来源:CItemSpawn.cpp

示例7: SetDirection

void ZActor::Attack_Range(rvector& dir)
{
	m_Animation.Input(ZA_INPUT_ATTACK_RANGE);

	SetDirection(dir);
	rvector pos;
	pos = m_Position + rvector(0, 0, 100);
	ZPostNPCRangeShot(GetUID(), g_pGame->GetTime(), pos, pos + 10000.f*dir, MMCIP_PRIMARY);
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:9,代码来源:ZActor.cpp

示例8: LOG_DEBUG

int       Session::Kick(int reason)
{
    if(GetState() == Session::PLAYER_STATE_KICKING )
    {
        return -1;
    }
    LOG_DEBUG("kick uid = %lu reason = %u [maybe todo notify reason]",GetUID(),reason);
    if(player)
    {
        player->Detach();
    }
    sessionMgr->GetLoginLogic().Logout(sessionMgr->GetSession(GetUID()));
    //-----------------------------------------------------------------
    ResponseClient(gate::GateSSMsg::EVENT_CLOSE,
                   gate::GateSSMsg::CONNECTION_CLOSE_BY_DEFAULT); 
    SetState(Session::PLAYER_STATE_KICKING);
    return 0;
}
开发者ID:jj4jj,项目名称:playground,代码行数:18,代码来源:Session.cpp

示例9: LOG

PNamedShape CTiglAbstractGeometricComponent::GetLoft(void)
{
    if (!(loft)) {
#ifdef DEBUG
        LOG(INFO) << "Building loft " << GetUID();
#endif
        loft = BuildLoft();
    }
    return loft;
}
开发者ID:hyper123,项目名称:tigl,代码行数:10,代码来源:CTiglAbstractGeometricComponent.cpp

示例10: ASSERT

bool CItemMulti::Multi_IsPartOf( const CItem * pItem ) const
{
	// Assume it is in my area test already.
	// IT_MULTI
	// IT_SHIP
	ASSERT( pItem );
	if ( pItem == this )
		return( true );
	return ( pItem->m_uidLink == GetUID());
}
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:10,代码来源:CItemMulti.cpp

示例11: GetMACAdress

/*
*********************************************************************************************************
*	函 数 名: GetMACAdress
*	功能说明: 获取设备MAC地址。MAC地址前面三个地址是IEEE给ST公司分配的数据
*	形    参: 将MAC地址写入mac指针
*	返 回 值: 无
*********************************************************************************************************
*/
void  GetMACAdress(uint8_t *mac) 
{
	uint8_t uid[12];
	GetUID(uid); 
	mac[0]=MAC0;
	mac[1]=MAC1;
	mac[2]=MAC2;
	mac[3]=uid[0]^uid[3]^uid[6]^uid[9];
	mac[4]=uid[1]^uid[4]^uid[7]^uid[10];
	mac[5]=uid[2]^uid[5]^uid[8]^uid[11];
}   
开发者ID:dasuimao,项目名称:DTS-2500_HMI0030_BOOT,代码行数:19,代码来源:bsp_uid.c

示例12: GetTopSector

void CItem::Spawn_GenerateChar( CResourceDef * pDef )
{
	if ( ! IsTopLevel())
		return;	// creatures can only be top level.
	if ( m_itSpawnChar.m_current >= GetAmount())
		return;
	int iComplexity = GetTopSector()->GetCharComplexity();
	if ( iComplexity > g_Cfg.m_iMaxCharComplexity )
	{
		DEBUG_MSG(( "Spawn uid=0%lx too complex (%d>%d)\n", GetUID(), iComplexity, g_Cfg.m_iMaxCharComplexity ));
		return;
	}

	int iDistMax = m_itSpawnChar.m_DistMax;
	RESOURCE_ID_BASE rid = pDef->GetResourceID();
	if ( rid.GetResType() == RES_SPAWN )
	{
		const CRandGroupDef * pSpawnGroup = STATIC_CAST <const CRandGroupDef *>(pDef);
		ASSERT(pSpawnGroup);
		int i = pSpawnGroup->GetRandMemberIndex();
		if ( i >= 0 )
		{
			rid = pSpawnGroup->GetMemberID(i);
		}
	}
	
	CREID_TYPE id;
	if ( rid.GetResType() == RES_CHARDEF || 
		rid.GetResType() == RES_UNKNOWN )
	{
		id = (CREID_TYPE) rid.GetResIndex();
	}
	else
	{
		return;
	}

	CChar * pChar = CChar::CreateNPC( id );
	if ( pChar == NULL )
		return;
	ASSERT(pChar->m_pNPC);

	m_itSpawnChar.m_current ++;
	pChar->Memory_AddObjTypes( this, MEMORY_ISPAWNED );
	// Move to spot "near" the spawn item.
	pChar->MoveNearObj( this, iDistMax );
	if ( iDistMax )
	{
		pChar->m_ptHome = GetTopPoint();
		pChar->m_pNPC->m_Home_Dist_Wander = iDistMax;
	}
	pChar->Update();
}
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:53,代码来源:CItemSp.cpp

示例13: jack_error

    int Shm::shmalloc (const char * /*shm_name*/, jack_shmsize_t size, jack_shm_info_t* si) {
        jack_shm_registry_t* registry;
        int shm_fd;
        int rc = -1;
        char name[SHM_NAME_MAX+1];
 
        if (shm_lock_registry () < 0) {
           jack_error ("jack_shm_lock_registry fails...");
           return -1;
        }

		sp<IAndroidShm> service = getShmService();
		if(service == NULL){
			rc = errno;
			jack_error("shm service is null");
			goto unlock;
		}
 
        if ((registry = get_free_shm_info ()) == NULL) {
           jack_error ("shm registry full");
           goto unlock;
        }

        snprintf (name, sizeof (name), "/jack-%d-%d", GetUID(), registry->index);
        if (strlen (name) >= sizeof (registry->id)) {
           jack_error ("shm segment name too long %s", name);
           goto unlock;
        }

        if((shm_fd = service->allocShm(size)) < 0) {
           rc = errno;
           jack_error ("Cannot create shm segment %s", name);
           goto unlock;
        }
        
        //close (shm_fd);
        registry->size = size;
        strncpy (registry->id, name, sizeof (registry->id) - 1);
        registry->id[sizeof (registry->id) - 1] = '\0';
        registry->allocator = GetPID();
        registry->fd = shm_fd;
        si->fd = shm_fd;
        si->index = registry->index;
        si->ptr.attached_at = MAP_FAILED;  /* not attached */
        rc = 0;  /* success */
        
        jack_d ("[APA] jack_shmalloc : ok ");

unlock:
        shm_unlock_registry ();
        return rc;
    }
开发者ID:jackaudio,项目名称:jack2,代码行数:52,代码来源:Shm.cpp

示例14: jack_set_server_prefix

/* set a unique per-user, per-server shm prefix string
 *
 * According to the POSIX standard:
 *
 *   "The name argument conforms to the construction rules for a
 *   pathname. If name begins with the slash character, then processes
 *   calling shm_open() with the same value of name refer to the same
 *   shared memory object, as long as that name has not been
 *   removed. If name does not begin with the slash character, the
 *   effect is implementation-defined. The interpretation of slash
 *   characters other than the leading slash character in name is
 *   implementation-defined."
 *
 * Since the Linux implementation does not allow slashes *within* the
 * name, in the interest of portability we use colons instead.
 */
static void
jack_set_server_prefix (const char *server_name)
{
#ifdef WIN32
    char buffer[UNLEN+1]={0};
    DWORD len = UNLEN+1;
    GetUserName(buffer, &len);
    snprintf (jack_shm_server_prefix, sizeof (jack_shm_server_prefix),
		  "jack-%s:%s:", buffer, server_name);
#else
    snprintf (jack_shm_server_prefix, sizeof (jack_shm_server_prefix),
		  "jack-%d:%s:", GetUID(), server_name);
#endif
}
开发者ID:AndrewCooper,项目名称:jack2,代码行数:30,代码来源:shm.c

示例15: GetConfiguration

// get short name for loft
std::string CCPACSFuselage::GetShortShapeName ()
{
    unsigned int findex = 0;
    for (int i = 1; i <= GetConfiguration().GetFuselageCount(); ++i) {
        tigl::CCPACSFuselage& f = GetConfiguration().GetFuselage(i);
        if (GetUID() == f.GetUID()) {
            findex = i;
            std::stringstream shortName;
            shortName << "F" << findex;
            return shortName.str();
        }
    }
    return "UNKNOWN";
}
开发者ID:gstariarch,项目名称:tigl,代码行数:15,代码来源:CCPACSFuselage.cpp


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