コード例 #1
0
ファイル: CHPRPCCommand.cpp プロジェクト: RoelofBerg/fimreg
/**
* Send the HPRPC command to the remote peer. This command will block until sending
* has startet but not block until sending has finished. It will return to the
* caller while sending is still in progress.
*
* DO NOT DESTROY THE BUFFER BEFORE SENDING THE DATA WILL BE FINISHED !
*/
void CHPRPCCommand::StartSendToOtherPeer(
	#if defined(_TRACE_HPRPC_)
	const string& CommandLogString
	#endif
	)
{
	#ifdef _DO_ERROR_CHECKS_
	if(false == mCommandBuffer.IsABufferAssigned())
	{
		//We can only send commands that were created before using AllocateBuffer().
		//E.g. by a method like CHPRPCCommandStoreImg::AssignValuesToBeSent()
		throw InvalidBufferException();
	}
	#endif

	//Send data (async)
	#if defined(_TRACE_HPRPC_)
	const uint32_t DSPIdx = m_HPRPCConnection.GetDSPIndex();
	printf("[DSP_%u] Start sending HPRPC command '%s'.\n", DSPIdx, CommandLogString.c_str());
	#endif

	//Send main buffer (header and for small commands also the data)
	CBufferedWriter& oBufferedWriter = GetBufferedWriter();
	oBufferedWriter.Send();

	#if defined(_TRACE_HPRPC_)
	printf("[DSP_%u] Sending of HPRPC command '%s' is now in progress.\n", DSPIdx, CommandLogString.c_str());
	#endif
}
コード例 #2
0
ファイル: CHPRPCCommand.cpp プロジェクト: RoelofBerg/fimreg
/**
* Return the begining of the payload (payload header if any or payload data).
* Throws an exception if no buffer was assigned yet.
* Before this method can succeed 
* AssignRcvBuffer() of one of the base classes must have been called (which
* will mean that either a new command to be send must have been generated or
* incoming data of a received command must have been assigned.)
*/
uint8_t* CHPRPCCommand::GetPayloadHeaderPtr()
{
	if(NULL == mpPayloadHeader)
	{
		throw InvalidBufferException();
	}

	return mpPayloadHeader;
}
コード例 #3
0
/**
* Return a pointer to the internal command specific header (exception if no header assigned)
*/
HPRPC_HDR_Request_CalcSSDJacHess* CHPRPCRequestCalcSSDJacHess::GetPayloadHeader()
{
	uint8_t* pHeader = GetPayloadHeaderPtr();

	if(NULL == pHeader)
	{
		throw InvalidBufferException();
	}

	return (HPRPC_HDR_Request_CalcSSDJacHess*)pHeader;
}
コード例 #4
0
void DecodePersistantList(VU_BYTE** stream, long *rem) {
	short	i,count = 0;

	CleanupPersistantList();

	memcpychk(&count, stream, sizeof(short), rem);			
#ifndef NDEBUG
	MonoPrint ("%d craters\n", count);
#endif

	if (count > MAX_PERSISTANT_OBJECTS){
		char err[200];
		sprintf(err, "%s %d: error decoding persistant, invalid count", __FILE__, __LINE__);
		throw InvalidBufferException(err);	
	}
	//ShiAssert (count < MAX_PERSISTANT_OBJECTS);

	// Load 'em
	for (i=0; i<count; i++){
		PersistantObjects[i].Load(stream);
	}
	persistantListTail = i%MAX_PERSISTANT_OBJECTS;
}