当前位置: 首页>>代码示例>>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;未经允许,请勿转载。