當前位置: 首頁>>代碼示例>>C++>>正文


C++ AllocateBuffer函數代碼示例

本文整理匯總了C++中AllocateBuffer函數的典型用法代碼示例。如果您正苦於以下問題:C++ AllocateBuffer函數的具體用法?C++ AllocateBuffer怎麽用?C++ AllocateBuffer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AllocateBuffer函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的AllocateBuffer函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。