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

C++ GetPointer函数代码示例

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

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



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


示例16: assert

/**
 * Fetch speaker ID.  This is done by sending a timestamp to the
 * server.  It should respond immediately with a speaker ID, otherwise
 * everything will grind to a halt.
 */
bool Tracter::SpeakerIDSocketSource::UnaryFetch(IndexType iIndex, int iOffset)
{
    assert(mFrame.size == 1);

    Verbose(2, "Fetching SpeakerID for index %ld\n", iIndex);
    char* cache = (char*)GetPointer(iOffset);

    // Send time stamp to the socket: converting from nanoseconds
    // to milliseconds
    //TimeType timestamp = ( TimeStamp(0)+TimeOffset(iIndex) ) / 1000000;
    //TimeType timestamp = TimeStamp(iIndex) / 1000000;  ///<--- This doesn't seem to work!
    // PNG: Incoming index is absoute time in seconds
    TimeType timestamp = (TimeType)iIndex * ONEe3 + mTimeOffset;
    Verbose(2, "Sending time %lld ms\n", timestamp);
#if 1
    mSocket.Send(sizeof(TimeType), (char*)&timestamp);

    // Read the data from the socket
    Verbose(2, "Waiting for response\n");
    int nGet = sizeof(float);
    int nGot = mSocket.Receive(nGet, cache);
    Verbose(2, "Got %d bytes\n", (int)nGot);
    if (nGot < nGet)
        return false;
#else
    arraySize += 1; //dummy
    cache[0] = 'a';
    cache[1] = 'b';
    cache[2] = 'c';
    cache[3] = 0;
#endif

    return true;
}
开发者ID:koemei,项目名称:tracter,代码行数:39,代码来源:SpeakerIDSocketSource.cpp


示例17: CommandToBlob

MCmdParamBlob* CommandToBlob(MCommand& Command)
{
	size_t BlobSize = Command.GetSize();
	auto Param = new MCmdParamBlob(BlobSize);
	Command.GetData(static_cast<char*>(Param->GetPointer()), BlobSize);
	return Param;
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:7,代码来源:MCommandCommunicator.cpp


示例18: getPointer

static
PyObject* getPointer(PyObject* self, PyObject* args) {
    PyObject* obj;
    if (!PyArg_ParseTuple(args, "O", &obj)){
        return NULL;
    }
    return GetPointer(obj);
}
开发者ID:KennethNielsen,项目名称:llvmpy,代码行数:8,代码来源:capsule.cpp


示例19: CopyFromEmu

void CopyFromEmu(void* data, u32 address, size_t size)
{
    if (!ValidCopyRange(address, size))
    {
        PanicAlert("Invalid range in CopyFromEmu. %lx bytes from 0x%08x", (unsigned long)size, address);
        return;
    }
    memcpy(data, GetPointer(address), size);
}
开发者ID:bradparks,项目名称:dolphin,代码行数:9,代码来源:Memmap.cpp


示例20: Hash160

// This method implements the (ripemd160 . sha256) hash,
// so the result is 20 bytes long.
bool Identifier::CalculateDigest(const unsigned char* data, size_t len)
{
    // The Hash160 function comes from the Bitcoin reference client, where
    // it is implemented as RIPEMD160 ( SHA256 ( x ) ) => 20 byte hash
    auto hash160 = Hash160(data, data + len);
    SetSize(20);
    memcpy(const_cast<void*>(GetPointer()), hash160, 20);
    return true;
}
开发者ID:yamamushi,项目名称:opentxs,代码行数:11,代码来源:Identifier.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetPoints函数代码示例发布时间:2022-05-30
下一篇:
C++ GetPoint函数代码示例发布时间: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