您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AllocateBuffer函数代码示例

51自学网 2021-06-01 19:46:33
  C++
这篇教程C++ AllocateBuffer函数代码示例写得很实用,希望能帮到您。

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

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


示例2: AllocateBuffer

CVoiceDataPacket::CVoiceDataPacket ( void ){    m_pBuffer = NULL;    m_usDataBufferSize = 0;    m_usActualDataLength = 0;    AllocateBuffer ( 1024 );}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:8,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例17: fclose

HRESULTSoundD3D::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,


示例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,


示例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,


示例20: AllocateBuffer

HRESULTSoundD3D::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,


示例21: allocWithCopyObjRecord

static void allocWithCopyObjRecord(ParserObjectRecordT** a, ParserObjectRecordT* b){    int i;    if (!b) {*a = 0; return;}    *a = AllocateBuffer(sizeof(ParserObjectRecordT));    (*a)->n = b->n;    (*a)->parent = b->parent;    (*a)->seq = AllocateArray(b->n, sizeof(ParserObjectT));    for (i = 0; i < b->n; i++) {        copyObjToObj((*a)->seq + i, b->seq + i);        (*a)->seq[i].parent = *a;        if ((*a)->seq[i].objKind == PARSER_OBJECT_KIND_SEQUENCE) (*a)->seq[i].rec->parent = *a;    }}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:14,


示例22: lockbox

void* DiGLTextureDrv::LockLevel(uint32 level, uint32 surface, DiLockFlag lockflag){    DiBox lockbox(0, 0, mBuffer->GetWidth(), mBuffer->GetHeight());    AllocateBuffer();    mCurrentLockFlag = lockflag;    if (lockflag != LOCK_DISCARD)    {        Download(*mBuffer, level, surface);    }    return mBuffer->data;}
开发者ID:zxy2845986,项目名称:Demi3D,代码行数:14,


示例23: ASSERT

// initialize the content with textint CMimeBody::SetText(const char* pbText, int nLength/*=0*/){	ASSERT(pbText != NULL);	if (!nLength)		nLength = (int)::strlen((char*)pbText);	if (!AllocateBuffer(nLength+4))		return -1;	::memcpy(m_pbText, pbText, nLength);	m_pbText[nLength] = 0;	m_nTextSize = nLength;	return nLength;}
开发者ID:SeekingFor,项目名称:FMS,代码行数:15,


示例24: parseNextObject

static ParserObjectT* parseNextObject(ParserObjectRecordT* curSeq){    ParserObjectKindT objKind;    ParserObjectT* res;    ParserObjectAttrT* attrList;    char* name;    ParserObjectRecordWithDataT tmp;    if (!curToken) return NULL;    if (curToken->type != ttObject) {        genParseError(E_OBJECT_KIND_EXPECTED);        return NULL;    }    objKind = curToken->value;    moveToNextToken();    attrList = parseAttrList(objKind, curSeq);    if (attrList) {        name = attrList[PARSER_OBJECT_ATTR_NAME].strVal;        if (name) { // if name doesn't exist, than it's unnamed objKind            tmp.pointerToData = 0; tmp.recPart = curSeq;            if (ParserFindObject(name, tmp, 0).objPart) {                genParseError(E_DUPLICATE_OBJECT);                attrListDestructor(attrList);                return NULL;            }        }    }    if (attrList ||        objKind == PARSER_OBJECT_KIND_END ||        objKind == PARSER_OBJECT_KIND_NEWLINE ||        objKind == PARSER_OBJECT_KIND_SOFTLINE)    {            res = AllocateBuffer(sizeof(ParserObjectT));            res->attrList = attrList; res->objKind = objKind;            if (objKind == PARSER_OBJECT_KIND_SEQUENCE) {                res->rec = parseObjRecord1(curSeq);                if (!res->rec) {objDestructor(res); return 0;}            } else res->rec = 0;            if (ParserIsErrorRaised()) {objDestructor(res); return 0;}            //res->parent = curSeq;  <- curSeq will reallocate anyway            return res;    }    genParseError(E_INVALID_ATTRIBUTE_LIST);    return NULL;}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:49,


示例25: AllocateBuffer

voidAnalyserNode::SetFftSize(uint32_t aValue, ErrorResult& aRv){  // Disallow values that are not a power of 2 and outside the [32,2048] range  if (aValue < 32 ||      aValue > 2048 ||      (aValue & (aValue - 1)) != 0) {    aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);    return;  }  if (FftSize() != aValue) {    mAnalysisBlock.SetFFTSize(aValue);    AllocateBuffer();  }}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:15,


示例26: InsertSocketObj

int MightyTCPCompletionPortServer::InsertSocketObj(PCompletionPortIOObject pSocket){		//GUID guid_val;		string guid_strkey=P2PUtilTools::GetStringUuid();		pSocket->identityIDKey=guid_strkey;		m_ActiveSocketMap.insert(map<string,PCompletionPortIOObject>::value_type(guid_strkey,pSocket));		//nSocketCount++;		PCompletionPort_BufObj pIOBuf=AllocateBuffer(pSocket,4096);		PostRecv(pIOBuf);		m_pNotifyCallBack->OnAccept(guid_strkey);		return 0;	}
开发者ID:guangminghan,项目名称:CyclonicGameEngine,代码行数:15,


示例27: ASSERT

   // initialize the content of this body part with a mail message   bool MimeBody::SetMessage(const MimeBody* pMM)   {      ASSERT(pMM != NULL);      int nSize = pMM->GetLength();      if (!AllocateBuffer(nSize+4))         return false;      pMM->Store(m_pbText);      const char* pszType = GetContentType();      if (!pszType || ::_memicmp(pszType, "message", 7) != 0)         SetContentType("message/rfc822", "");      return true;   }
开发者ID:Bill48105,项目名称:hmailserver,代码行数:16,


示例28: autoGenInt

void autoGenInt(ParserObjectWithDataT info){    int64_t l, r, tmp;    if (info.objPart->objKind != PARSER_OBJECT_KIND_INTEGER) {        genParseError(E_GENERATE_NON_INT);        return;    }    if (!info.pointerToData->value) {        ParserEvaluateIntRange(info, &l, &r);        if (ParserIsErrorRaised()) return;        tmp = GenerateRandInt(l, r);        info.pointerToData->value = AllocateBuffer(sizeof(tmp));        memcpy(info.pointerToData->value, &tmp, sizeof(tmp));    }}
开发者ID:klenin,项目名称:CATS-EasyGen,代码行数:15,



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


C++ AllocateCopyPool函数代码示例
C++ AllocateAndInitializeSid函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。