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

C++ AllocateBuffer函数代码示例

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

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



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

示例1: AllocateBuffer

 /// \brief
 ///   Assignment operator. Deep copies the buffer.
 inline IVConstantBuffer &operator = (const IVConstantBuffer &other)
 {
   AllocateBuffer(other.m_iFirstRegister,other.m_iAllocatedEntries);
   if (m_iAllocatedEntries>0)
     memcpy(m_pBuffer,other.m_pBuffer,GetByteCount());
   m_spTable = ((IVConstantBuffer &)other).m_spTable; ///< no assignment operator!
   return *this;
 }
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:10,代码来源:vConstantBuffer.hpp


示例2: AllocateBuffer

CVoiceDataPacket::CVoiceDataPacket ( void )
{
    m_pBuffer = NULL;
    m_usDataBufferSize = 0;
    m_usActualDataLength = 0;

    AllocateBuffer ( 1024 );
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:8,代码来源:CVoiceDataPacket.cpp


示例3: parseObjRecord1

static ParserObjectRecordT* parseObjRecord1(ParserObjectRecordT* parent)
{
    ParserObjectT* curObj;
    ParserObjectRecordT *res, *tmp;
    int wasEnd = 0;
    int i;
    res = AllocateBuffer(sizeof(ParserObjectRecordT));
    res->n = 0; res->seq = 0; res->parent = parent;

    while ((curObj = parseNextObject(res))) {
        if (curObj->objKind == PARSER_OBJECT_KIND_END) {
            if (!parent) {
                genParseError(E_UNEXPECTED_END);
            } else {
                objDestructor(curObj);
                wasEnd = 1;
            }
            break;
        }
        res->n++;
        tmp = AllocateBuffer(sizeof(ParserObjectRecordT));
        tmp->seq = AllocateArray(res->n, sizeof(ParserObjectT));
        for (i = 0; i < res->n - 1; i++) {
            copyObjToObj(tmp->seq + i, res->seq + i);
            tmp->seq[i].parent = tmp;
            if (tmp->seq[i].objKind == PARSER_OBJECT_KIND_SEQUENCE) tmp->seq[i].rec->parent = tmp;
        }
        tmp->parent = res->parent; tmp->n = res->n;
        res->n--; ParserDestroyObjectRecord(res);
        copyObjToObj(tmp->seq + tmp->n - 1, curObj);
        tmp->seq[tmp->n - 1].parent = tmp;
        if (tmp->seq[tmp->n - 1].objKind == PARSER_OBJECT_KIND_SEQUENCE)
            tmp->seq[tmp->n - 1].rec->parent = tmp;
        res = tmp;
        objDestructor(curObj);
    }

    if (!wasEnd && parent) {
        genParseError(E_END_EXPECTED);
    }

    if (ParserIsErrorRaised()) {ParserDestroyObjectRecord(res); return 0;}
    return res;
}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:44,代码来源:ParserMain.c


示例4: allocWithCopyExpr

static void allocWithCopyExpr(struct expr** a, struct expr* b)
{
    if (!b) {*a = 0; return;}
    *a = AllocateBuffer(sizeof(struct expr));
    (*a)->intConst = b->intConst;
    (*a)->opCode = b->opCode;
    allocWithCopyStr(&((*a)->varName), b->varName);
    allocWithCopyExpr(&((*a)->op1), b->op1);
    allocWithCopyExpr(&((*a)->op2), b->op2);
}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:10,代码来源:ParserMain.c


示例5: AllocateBuffer

uint8_t*
PlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize)
{
  // update buffer size
  mBufferSize = aSize;

  // get new buffer
  mBuffer = AllocateBuffer(mBufferSize); 
  return mBuffer;
}
开发者ID:Romitarath,项目名称:mozilla-central,代码行数:10,代码来源:ImageContainer.cpp


示例6: AllocateBuffer

BOOL CIOCPServer::SendText(CIOCPContext *pContext, char *pszText, int nLen)
{
	CIOCPBuffer *pBuffer = AllocateBuffer(nLen);
	if(pBuffer != NULL)
	{
		memcpy(pBuffer->buff, pszText, nLen);
		return PostSend(pContext, pBuffer);
	}
	return FALSE;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:10,代码来源:IOCP.CPP


示例7: main

int main(int argc, char *argv[])
{
	assert(argc == 2);
	char * outFileName = argv[1];
	FILE *outFile = fopen(outFileName, "w");
	
	
	int dtFlyPinitStatus = InitDevice(userIntHandler);
	assert(dtFlyPinitStatus == 0);	
	int status;
/*	
	uint32_t regData[1];
	uint32_t regAddress = 513;
	
	// Read, write, then read again register 0
	// ReadWriteConfigRegs(direction, registerNumber, registerDataBuffer, numberOfRegisters)
	status = ReadWriteConfigRegs(READ, regAddress, regData, 1);
	printf("Read status is %d, value is %08lx\n", status, regData[0]);

	regData[0] = 0x12345678;
	status = ReadWriteConfigRegs(WRITE, regAddress, regData, 1);
	printf("Write status is %d\n", status);

	status = ReadWriteConfigRegs(READ, regAddress, regData, 1);
	printf("Read status is %d, value is %08lx\n", status, regData[0]);

	*/
	
	/*
	 * Read and dump to file
	 */ 
	SBufferInit buffer;
	unsigned bufferIndex = 0;
	AllocateBuffer(bufferIndex, &buffer);
	
	for(int nReads = 0; nReads < 10; nReads += 1) {
		status = ReceiveDMAbyBufIndex(DMA1, bufferIndex, 1);
		if(status > 0) {
			uint64_t *wordBuffer = (uint64_t *)buffer.UserAddr;
			int nWords = status / sizeof(uint64_t);
			
			for(int i = 0; i < nWords; i++) {
				fprintf(outFile, "%016llx\n", wordBuffer[i]);
			}
		}
	}	
	ReleaseBuffer(bufferIndex);	
	
	
	
	ReleaseDevice();
	fclose(outFile);
	return 0;
}
开发者ID:lferramacho,项目名称:sw_daq_tofpet,代码行数:54,代码来源:registerTest2.cpp


示例8: getSubString

static char* getSubString(const char* string, size_t left, size_t right)
{
    char* substr = NULL;
    if (right >= left) {
        size_t len = right - left;
        substr = AllocateBuffer(len + 2);
        substr[0] = 0;
        strncat(substr, string + left, len + 1);
    }
    return substr;
}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:11,代码来源:ParserMain.c


示例9: _numBuffers

RingBuffer<T>::RingBuffer(int numBuf, int bufSize):
   _numBuffers(numBuf), _bufSize(bufSize)
{
  AllocateBuffer();
  _readPos = 0;
  _writePos = 0;

  pthread_mutex_init(&_lock, NULL);
  pthread_cond_init(&_rdcond, NULL);
  pthread_cond_init(&_wrcond, NULL);
}
开发者ID:Lingrui,项目名称:TS,代码行数:11,代码来源:RingBuffer.cpp


示例10: Disconnect

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	AUInputElement::SetInputCallback
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void	AUInputElement::SetInputCallback(AURenderCallback proc, void *refCon)
{
	if (proc == NULL)
		Disconnect();
	else {
		mInputType = kFromCallback;
		mInputProc = proc;
		mInputProcRefCon = refCon;
		AllocateBuffer();
	}
}
开发者ID:abscura,项目名称:audiounitjs,代码行数:15,代码来源:AUInputElement.cpp


示例11: _Release1DBuffer

void BPFlow::AllocateMessage()
{
	// delete the buffers for the messages
	for(int i=0;i<2;i++)
	{
		_Release1DBuffer(pSpatialMessage[i]);
		_Release1DBuffer(ptrSpatialMessage[i]);
		_Release1DBuffer(pDualMessage[i]);
		_Release1DBuffer(ptrDualMessage[i]);
		_Release1DBuffer(pBelief[i]);
		_Release1DBuffer(ptrBelief[i]);
	}
	// allocate the buffers for the messages
	for(int i=0;i<2;i++)
	{
		nTotalSpatialElements[i]=AllocateBuffer(pSpatialMessage[i],nNeighbors,ptrSpatialMessage[i],pWinSize[i]);
		nTotalDualElements[i]=AllocateBuffer(pDualMessage[i],1,ptrDualMessage[i],pWinSize[i]);
		nTotalBelifElements[i]=AllocateBuffer(pBelief[i],1,ptrBelief[i],pWinSize[i]);
	}
}
开发者ID:carjun,项目名称:depthEffects,代码行数:20,代码来源:BPFlow.cpp


示例12: parseSingleToken

static char* parseSingleToken(int tokenType)
{
    char* res = NULL;
    if (curToken && curToken->type == tokenType) {
        res = AllocateBuffer(strlen(curToken->str) + 1);
        strcpy(res, curToken->str);
        moveToNextToken();
    } else {
        genParseError(E_UNEXPECTED_TOKEN);
    }
    return res;
}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:12,代码来源:ParserMain.c


示例13: AllocateBuffer

	void VolumePassword::Set (const byte *password, size_t size)
	{
		AllocateBuffer ();
		
		if (size > MaxSize)
			throw PasswordTooLong (SRC_POS);
		
		PasswordBuffer.CopyFrom (ConstBufferPtr (password, size));
		PasswordSize = size;

		Unportable = !IsPortable();
	}
开发者ID:cocoon,项目名称:VeraCrypt,代码行数:12,代码来源:VolumePassword.cpp


示例14: m_buffer_size

D3DStreamBuffer::D3DStreamBuffer(size_t initial_size, size_t max_size, bool* buffer_reallocation_notification) :
	m_buffer_size(initial_size),
	m_buffer_max_size(max_size),
	m_buffer_reallocation_notification(buffer_reallocation_notification)
{
	CHECK(initial_size <= max_size, "Error: Initial size for D3DStreamBuffer is greater than max_size.");

	AllocateBuffer(initial_size);

	// Register for callback from D3DCommandListManager each time a fence is queued to be signaled.
	m_buffer_tracking_fence = D3D::command_list_mgr->RegisterQueueFenceCallback(this, &D3DStreamBuffer::QueueFenceCallback);
}
开发者ID:Abrahamh08,项目名称:dolphin,代码行数:12,代码来源:D3DStreamBuffer.cpp


示例15: AllocateBuffer

BOOL CIOCPServer::SendText(CIOCPContext *pContext, char *pszText, int nLen)
{
	CIOCPBuffer *pBuffer = AllocateBuffer(nLen);
	if(pBuffer != NULL)
	{
		memcpy(pBuffer->buff, pszText, nLen);
		if (PostSend(pContext, pBuffer))
			return true;
  	    ReleaseBuffer(pBuffer);
	}
	return false;
}
开发者ID:chenboo,项目名称:GameServer,代码行数:12,代码来源:IOCP.CPP


示例16: NewConnection

Connection* NewConnection(BufferPool* pool, Address* address, bool freeAddress) {
    Connection* connection = NULL;

    if ((connection = aio4c_malloc(sizeof(Connection))) == NULL) {
        return NULL;
    }


    connection->readBuffer = AllocateBuffer(pool);
    connection->writeBuffer = AllocateBuffer(pool);
    BufferLimit(connection->writeBuffer, 0);
    connection->dataBuffer = NULL;
    connection->socket = -1;
    connection->state = AIO4C_CONNECTION_STATE_NONE;
    connection->stateLock = NewLock();
    connection->systemHandlers = NewEventQueue();
    connection->userHandlers = NewEventQueue();
    connection->address = address;
    connection->closedForError = false;
    connection->string = AddressGetString(address);
    connection->stringAllocated = false;
    memset(connection->closedBy, 0, AIO4C_CONNECTION_OWNER_MAX * sizeof(bool));
    connection->closedBy[AIO4C_CONNECTION_OWNER_ACCEPTOR] = true;
    connection->closedByLock = NewLock();
    memset(connection->managedBy, 0, AIO4C_CONNECTION_OWNER_MAX * sizeof(bool));
    connection->managedBy[AIO4C_CONNECTION_OWNER_ACCEPTOR] = true;
    connection->managedBy[AIO4C_CONNECTION_OWNER_CLIENT] = true;
    connection->managedByLock = NewLock();
    connection->readKey = NULL;
    connection->writeKey = NULL;
    connection->pool = NULL;
    connection->freeAddress = freeAddress;
    connection->dataFactory = NULL;
    connection->dataFactoryArg = NULL;
    connection->canRead = false;
    connection->canWrite = false;
    connection->isFactory = false;

    return connection;
}
开发者ID:blakawk,项目名称:Aio4c,代码行数:40,代码来源:connection.c


示例17: fclose

HRESULT
SoundD3D::StreamOggFile()
{
	DWORD buf_size    = wfex.nAvgBytesPerSec / 2;
	DWORD safety_zone = buf_size * 2;

	if (stream) {
		delete[] transfer;
		fclose(stream);

		transfer = 0;
		stream   = 0;
	}

	status         = UNINITIALIZED;
	stream_left    = (DWORD) ov_pcm_total(ov_file,-1);
	stream_offset  = 0;

	eos_written    = false;
	eos_latch      = 0;
	min_safety     = safety_zone;
	read_size      = buf_size;

	total_time     = (double) stream_left /
	(double) wfex.nAvgBytesPerSec;

	if (stream_left < read_size) {
		read_size = stream_left;
	}

	HRESULT hr = AllocateBuffer(read_size + min_safety);

	if (FAILED(hr))
	return hr;

	flags |= STREAMED | OGGVORBIS;

	// preload the buffer:
	w = r = 0;
	transfer = new(__FILE__,__LINE__) BYTE[read_size + 1024];

	if (!transfer) {
		hr = E_FAIL;
	}

	else {
		ZeroMemory(transfer, read_size+1024);
		StreamOggBlock();
	}

	return hr;
}
开发者ID:lightgemini78,项目名称:Starshatter-Rearmed,代码行数:52,代码来源:SoundD3D.cpp


示例18: AppendLog

BOOL SecureChatIOCP::SendTextMessageTo(ClientContext* pContext, CString sMsg)
{

	if ( !pContext->m_bGotSessionKey )
	{
		//AppendLog("Client is not authorized");
		return FALSE;
	}

	UINT nBufLen = sMsg.GetLength();
	// Add one to the size header for the null termination byte. 
	nBufLen++;
	// Add one for the Payload type (text)
	nBufLen++;

	if ( nBufLen>=MaxEncyptedPayloadSize(MAXIMUMPAYLOADSIZE-2) )
	{
		AppendLog("SendMessageTo FAILED Message to long for encryption..");
		return FALSE;
	}

	if ( nBufLen>=MAXIMUMPAYLOADSIZE || nBufLen<=0 )
	{
		AppendLog("SendMessageTo FAILED Message to long or zero..");
		return FALSE;
	}

	CIOCPBuffer *pBuff=AllocateBuffer(IOWrite);

	if ( !pBuff )
	{
		AppendLog("SendMessageTo FAILED pOverlapBuff=NULL");
		return FALSE;
	}

	pBuff->EmptyUsed();
	// Size Header
	pBuff->AddData(nBufLen);
	// Payload Header 
	pBuff->AddData((BYTE)PKG_TEXT_TO_ALL);
	// Add the string. 
	int length=sMsg.GetLength();
	pBuff->AddData((PBYTE) sMsg.GetBuffer(length),length);
	//Extra Null Teriminate (for Strings) 
	pBuff->AddData((BYTE)'\0');
	// Encrypt the buffer
	pBuff=EnCryptBuffer(pBuff,pContext);
	// Send it. 
	ASend(pContext,pBuff);
	return TRUE;

}
开发者ID:Coder-666,项目名称:uRSAlib,代码行数:52,代码来源:SecureChatIOCP.cpp


示例19: AllocateBuffer

void CMatlabEngine::ProcessString( LPCTSTR szName, BSTR& bstrName)
{
	::SysFreeString(bstrName);

#ifndef _UNICODE
	int nChar;
	AllocateBuffer(_tcslen(szName));
	nChar=MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,szName,-1,m_pBuffer,m_uBufferSize);
	bstrName = ::SysAllocString(m_pBuffer);
#else
	bstrName = ::SysAllocString(OLESTR(szName));
#endif
}
开发者ID:Elrassam,项目名称:LRBP,代码行数:13,代码来源:MatlabEngine.cpp


示例20: AllocateBuffer

HRESULT
SoundD3D::Load(DWORD bytes, BYTE* data)
{
	status = UNINITIALIZED;

	HRESULT hr;

	if (!buffer) {
		hr = AllocateBuffer(bytes);
		if (FAILED(hr)) {
			return hr;
		}
	}

	LPVOID   dest1, dest2;
	DWORD    size1, size2;

	hr = buffer->Lock(w, bytes, &dest1, &size1, &dest2, &size2, 0);

	if (hr == DSERR_BUFFERLOST) {
		buffer->Restore();
		hr = buffer->Lock(w, bytes, &dest1, &size1, &dest2, &size2, 0);
	}

	if (SUCCEEDED(hr)) {
		CopyMemory(dest1, data, size1);
		if (dest2) {
			CopyMemory(dest2, data + size1, size2);
		}

		if (flags & STREAMED)
		w = (w + size1 + size2) % (read_size + min_safety);
		else
		w += size1 + size2;

		hr = buffer->Unlock(dest1, size1, dest2, size2);
		if (FAILED(hr)) {
			SoundD3DError("Load: could not unlock buffer", hr);
		}
	}
	else {
		SoundD3DError("Load: could not lock buffer", hr);
	}

	if (SUCCEEDED(hr)) {
		status = READY;
	}

	return hr;
}
开发者ID:lightgemini78,项目名称:Starshatter-Rearmed,代码行数:50,代码来源:SoundD3D.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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