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


C++ GetPointer函数代码示例

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


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

示例1: GetSize

// Message retrieved from Payload
bool OTPayload::GetMessage(OTMessage & theMessage) const
{
	// validate checksum
	uint32_t lSize	= GetSize();
	uint32_t lIndex	= lSize-2; // the index to where the NULL terminator SHOULD be if they
						  // sent us a string like they were supposed to. (A contract.)
						  // (nSize-1 would be the location of the checksum at the end.)
	if (0 == lSize)
		return false;
	
	if (IsChecksumValid((OT_BYTE*)GetPointer(), (uint32_t)lSize))
	{
		// We add the null-terminator ourselves at this point, for security reasons,
		// since we will process the data, after this point, as a string.
		((OT_BYTE *)GetPointer())[lIndex] = 0;
		
		theMessage.Release();
		
		// Why is this safe, where I cast the Payload data pointer as
		// a char * and tell the string to set itself from that?
		// Because (1) I just validated the checksum, and
		// (2) There place where the NULL should be, I set to 0, by hand,
		// just above 2 lines. So when this set operation occurs, the
		// farthest it will go is to that 0.
		theMessage.m_strRawFile.Set((const char *)GetPointer());
		return true;
	}
	else {
		OTLog::Error("Invalid Checksum in OTPayload::GetMessage\n");
		return false;
	}
}
开发者ID:batouzo,项目名称:Open-Transactions,代码行数:33,代码来源:OTPayload.cpp

示例2: GetImageStatisticsInvalid

  void GetImageStatisticsInvalid()
  {
    CreateNodeRelationImage(m_statisticsContainer.GetPointer(), m_image.GetPointer());

    CPPUNIT_ASSERT_THROW(mitk::ImageStatisticsContainerManager::GetImageStatistics(nullptr, m_image.GetPointer()), mitk::Exception);

    auto standaloneDataStorage = mitk::StandaloneDataStorage::New();

    CPPUNIT_ASSERT_THROW(mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), nullptr), mitk::Exception);
    CPPUNIT_ASSERT_THROW(mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), nullptr, m_mask.GetPointer()), mitk::Exception);
    CPPUNIT_ASSERT_THROW(mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), nullptr, m_planarFigure.GetPointer()), mitk::Exception);
  }
开发者ID:Cdebus,项目名称:MITK,代码行数:12,代码来源:mitkImageStatisticsContainerManagerTest.cpp

示例3: CHECK

HRESULT CMfxBufferFactory::CreateCopy( MFX_HBUFFER hbufOld, DWORD dwLength, MFX_HBUFFER* phbufNew )
{
	void*	pvSrc;
	void* pvDst;
	DWORD	cbSrc, cbDst;

	CHECK( GetPointer( hbufOld, &pvSrc, &cbSrc ) );
	CHECK( Create( dwLength, phbufNew ) );
	CHECK( GetPointer( *phbufNew, &pvDst, &cbDst ) );

	memcpy( pvDst, pvSrc, min( cbSrc, cbDst ) );

	return S_OK;
}
开发者ID:agangzz,项目名称:foo_midi,代码行数:14,代码来源:MfxBufferFactory.cpp

示例4: SetPayloadSize

bool OTPayload::SetMessage(const OTMessage & theMessage)
{
	uint32_t lSize = theMessage.m_strRawFile.GetLength()+1; //+1 for the null terminater
	
	if (theMessage.m_strRawFile.GetLength())
	{
		SetPayloadSize(lSize + 1); // +1 for the checksum byte.
		memcpy((void *)GetPointer(), theMessage.m_strRawFile.Get(), lSize);
		
		// Add the checksum
		AppendChecksum( (OT_BYTE*)GetPointer(), lSize );
		return true;
	}
	return false;
}
开发者ID:batouzo,项目名称:Open-Transactions,代码行数:15,代码来源:OTPayload.cpp

示例5: DoState

void DoState(PointerWrap &p)
{
	auto s = p.Section("Memory", 1, 2);
	if (!s)
		return;

	if (s < 2) {
		if (!g_RemasterMode)
			g_MemorySize = RAM_NORMAL_SIZE;
		g_PSPModel = PSP_MODEL_FAT;
	} else {
		u32 oldMemorySize = g_MemorySize;
		p.Do(g_PSPModel);
		p.DoMarker("PSPModel");
		if (!g_RemasterMode) {
			g_MemorySize = g_PSPModel == PSP_MODEL_FAT ? RAM_NORMAL_SIZE : RAM_DOUBLE_SIZE;
			if (oldMemorySize < g_MemorySize) {
				Shutdown();
				Init();
			}
		}
	}

	p.DoArray(GetPointer(PSP_GetKernelMemoryBase()), g_MemorySize);
	p.DoMarker("RAM");

	p.DoArray(m_pVRAM, VRAM_SIZE);
	p.DoMarker("VRAM");
	p.DoArray(m_pScratchPad, SCRATCHPAD_SIZE);
	p.DoMarker("ScratchPad");
}
开发者ID:ANR2ME,项目名称:ppsspp,代码行数:31,代码来源:MemMap.cpp

示例6: Java_com_aio4c_Connection_close

JNIEXPORT void JNICALL Java_com_aio4c_Connection_close(JNIEnv* jvm, jobject connection, jboolean force) {
    void* myConnection = NULL;

    GetPointer(jvm, connection, &myConnection);

    ConnectionClose(myConnection, force);
}
开发者ID:blakawk,项目名称:Aio4c,代码行数:7,代码来源:connection.c

示例7: pa_simple_read

/**
 * Contiguous Fetch.
 * The simple API is blocking, which is perfect for tracter.  Fab.
 */
Tracter::SizeType
Tracter::PulseAudioSource::ContiguousFetch(
    IndexType iIndex, SizeType iLength, SizeType iOffset
)
{
    if (mMaxIndex)
        if (iIndex > mMaxIndex)
            return 0;

    /* I'm assuming that it reads a whole buffer-full here */
    int error;
    int ret = pa_simple_read(
        mHandle,
        GetPointer(iOffset),
        iLength * sizeof(float),
        &error
    );
    if (ret < 0)
        throw Exception("%s: Failed to read %d samples. %s",
                        mObjectName, iLength, pa_strerror(error));

    if (mMaxIndex)
        if (iIndex + iLength > mMaxIndex)
            return mMaxIndex - iIndex;
    return iLength;
}
开发者ID:idiap,项目名称:tracter,代码行数:30,代码来源:PulseAudioSource.cpp

示例8: IsValid

bool Entity::IsValid()
{
	if( !GetPointer() )
		return false;

	if( !GetBoneMatrix() )
		return false;

	if( !GetTeamNum() )
		return false;

	if( IsDead() )
		return false;

	if( IsDormant() )
		return false;

	if( GetOrigin().IsZero() )
		return false;

	if( GetHealth() < 1 )
		return false;

	return true;
}
开发者ID:A5-,项目名称:CSGO-External,代码行数:25,代码来源:Entity.cpp

示例9: memcpy

void OTIdentifier::CopyTo(uint8_t * szNewLocation) const
{
	if (GetSize())
	{
		memcpy((void*)GetPointer(), szNewLocation, GetSize()); // todo cast
	}
}
开发者ID:Tectract,项目名称:Open-Transactions,代码行数:7,代码来源:OTIdentifier.cpp

示例10: Java_com_aio4c_Connection_enableWriteInterest

JNIEXPORT void JNICALL Java_com_aio4c_Connection_enableWriteInterest(JNIEnv* jvm, jobject connection) {
    void* myConnection = NULL;

    GetPointer(jvm, connection, &myConnection);

    EnableWriteInterest(myConnection);
}
开发者ID:blakawk,项目名称:Aio4c,代码行数:7,代码来源:connection.c

示例11: GetPointer

void CBotVar::SetInit(int bInit)
{
    m_binit = bInit;
    if ( bInit == 2 ) m_binit = IS_DEF;                    // cas spécial

    if ( m_type.Eq(CBotTypPointer) && bInit == 2 )
    {
        CBotVarClass* instance = GetPointer();
        if ( instance == NULL )
        {
            instance = new CBotVarClass(NULL, m_type);
//            instance->SetClass((static_cast<CBotVarPointer*>(this))->m_pClass);
            SetPointer(instance);
        }
        instance->SetInit(1);
    }

    if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) )
    {
        CBotVar*    p = (static_cast<CBotVarClass*>(this))->m_pVar;
        while( p != NULL )
        {
            p->SetInit( bInit );
            p->m_pMyThis = static_cast<CBotVarClass*>(this);
            p = p->GetNext();
        }
    }
}
开发者ID:colobotLeaner,项目名称:colobot,代码行数:28,代码来源:CBotVar.cpp

示例12: Commit

void CKConfig::Commit() const
{
    if ( rc_t rc = KConfigCommit(const_cast<KConfig*>(GetPointer())) ) {
        NCBI_THROW2(CSraException, eOtherError,
                    "CKConfig: Cannot commit config changes", rc);
    }
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:7,代码来源:vdbread.cpp

示例13: GetPointer

void CBotVar::SetInit(CBotVar::InitType initType)
{
    m_binit = initType;
    if (initType == CBotVar::InitType::IS_POINTER ) m_binit = CBotVar::InitType::DEF;                    // cas spécial

    if ( m_type.Eq(CBotTypPointer) && initType == CBotVar::InitType::IS_POINTER )
    {
        CBotVarClass* instance = GetPointer();
        if ( instance == nullptr )
        {
            instance = new CBotVarClass(CBotToken(), m_type);
//            instance->SetClass((static_cast<CBotVarPointer*>(this))->m_classes);
            SetPointer(instance);
        }
        instance->SetInit(CBotVar::InitType::DEF);
    }

    if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) )
    {
        CBotVar*    p = (static_cast<CBotVarClass*>(this))->m_pVar;
        while( p != nullptr )
        {
            p->SetInit(initType);
            p->m_pMyThis = static_cast<CBotVarClass*>(this);
            p = p->GetNext();
        }
    }
}
开发者ID:Grunaka,项目名称:colobot,代码行数:28,代码来源:CBotVar.cpp

示例14: AudioSamplePtr

AudioSamplePtr ETHAudioResourceManager::GetPointer(AudioPtr audio,
										  const str_type::string &fileRelativePath, const str_type::string &programPath,
										  const str_type::string &searchPath, const GS_SAMPLE_TYPE type)
{
	if (fileRelativePath == GS_L(""))
		return AudioSamplePtr();

	if (!m_resource.empty())
	{
		str_type::string fileName = ETHGlobal::GetFileName(fileRelativePath);
		std::map<str_type::string, AudioSamplePtr>::iterator iter = m_resource.find(fileName);
		if (iter != m_resource.end())
			return iter->second;
	}

	// we can set a search path to search the file in case
	// it hasn't been loaded yet
	if (searchPath != GS_L(""))
	{
		str_type::string fileName = ETHGlobal::GetFileName(fileRelativePath);

		str_type::string path = programPath;
		path += searchPath;
		path += fileName;
		AddFile(audio, path, type);
		return GetPointer(audio, fileName, programPath, GS_L(""), type);
	}
	return AudioSamplePtr();
}
开发者ID:nikki93,项目名称:ethanon,代码行数:29,代码来源:ETHResourceManager.cpp

示例15: _GetBuffer

static Buffer* _GetBuffer(JNIEnv* jvm, jobject buffer) {
    void* _buffer = NULL;

    GetPointer(jvm, buffer, &_buffer);

    return (Buffer*)_buffer;
}
开发者ID:blakawk,项目名称:Aio4c,代码行数:7,代码来源:buffer.c


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