📄 modul.h
字号:
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter, OutputBuffer);
}
template<class TInput, class TOutput> void
CReceiverModul<TInput, TOutput>::Init(CParameter& Parameter,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TOutput>& OutputBuffer2)
{
/* Init some internal variables */
iMaxOutputBlockSize2 = 0;
iOutputBlockSize2 = 0;
bResetBuf = FALSE;
bResetBuf2 = FALSE;
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter, OutputBuffer);
/* Init output transfer buffers */
if (iMaxOutputBlockSize2 != 0)
OutputBuffer2.Init(iMaxOutputBlockSize2);
else
{
if (iOutputBlockSize2 != 0)
OutputBuffer2.Init(iOutputBlockSize2);
}
}
template<class TInput, class TOutput> void
CReceiverModul<TInput, TOutput>::Init(CParameter& Parameter,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TOutput>& OutputBuffer2,
CBuffer<TOutput>& OutputBuffer3)
{
/* Init some internal variables */
iMaxOutputBlockSize2 = 0;
iMaxOutputBlockSize3 = 0;
iOutputBlockSize2 = 0;
iOutputBlockSize3 = 0;
bResetBuf = FALSE;
bResetBuf2 = FALSE;
bResetBuf3 = FALSE;
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter, OutputBuffer);
/* Init output transfer buffers */
if (iMaxOutputBlockSize2 != 0)
OutputBuffer2.Init(iMaxOutputBlockSize2);
else
{
if (iOutputBlockSize2 != 0)
OutputBuffer2.Init(iOutputBlockSize2);
}
if (iMaxOutputBlockSize3 != 0)
OutputBuffer3.Init(iMaxOutputBlockSize3);
else
{
if (iOutputBlockSize3 != 0)
OutputBuffer3.Init(iOutputBlockSize3);
}
}
template<class TInput, class TOutput>
_BOOLEAN CReceiverModul<TInput, TOutput>::
ProcessData(CParameter& Parameter, CBuffer<TInput>& InputBuffer,
CBuffer<TOutput>& OutputBuffer)
{
/* Check initialization flag. The initialization must be done OUTSIDE
the processing routine. This is ensured by doing it here, where we
have control of calling the processing routine. Therefore we
introduced the flag */
if (bDoInit == TRUE)
{
/* Call init routine */
Init(Parameter, OutputBuffer);
/* Reset init flag */
bDoInit = FALSE;
}
/* Special case if input block size is zero */
if (iInputBlockSize == 0)
{
InputBuffer.Clear();
return FALSE;
}
/* INPUT-DRIVEN modul implementation in the receiver -------------------- */
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* Check if enough data is available in the input buffer for processing */
if (InputBuffer.GetFillLevel() >= iInputBlockSize)
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
/* Copy extended data from vectors */
(*pvecOutputData).SetExData((*pvecInputData).GetExData());
/* Call the underlying processing-routine */
ProcessDataThreadSave(Parameter);
/* Reset output-buffers if flag was set by processing routine */
if (bResetBuf == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf = FALSE;
OutputBuffer.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
}
return bEnoughData;
}
template<class TInput, class TOutput>
_BOOLEAN CReceiverModul<TInput, TOutput>::
ProcessData(CParameter& Parameter, CBuffer<TInput>& InputBuffer,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TOutput>& OutputBuffer2)
{
/* Check initialization flag. The initialization must be done OUTSIDE
the processing routine. This is ensured by doing it here, where we
have control of calling the processing routine. Therefore we
introduced the flag */
if (bDoInit == TRUE)
{
/* Call init routine */
Init(Parameter, OutputBuffer, OutputBuffer2);
/* Reset init flag */
bDoInit = FALSE;
}
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* INPUT-DRIVEN modul implementation in the receiver -------------------- */
/* Check if enough data is available in the input buffer for processing */
if (InputBuffer.GetFillLevel() >= iInputBlockSize)
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
pvecOutputData2 = OutputBuffer2.QueryWriteBuffer();
/* Call the underlying processing-routine */
ProcessDataThreadSave(Parameter);
/* Reset output-buffers if flag was set by processing routine */
if (bResetBuf == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf = FALSE;
OutputBuffer.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
if (bResetBuf2 == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf2 = FALSE;
OutputBuffer2.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer2.Put(iOutputBlockSize2);
}
}
return bEnoughData;
}
template<class TInput, class TOutput>
_BOOLEAN CReceiverModul<TInput, TOutput>::
ProcessData(CParameter& Parameter, CBuffer<TInput>& InputBuffer,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TOutput>& OutputBuffer2,
CBuffer<TOutput>& OutputBuffer3)
{
/* Check initialization flag. The initialization must be done OUTSIDE
the processing routine. This is ensured by doing it here, where we
have control of calling the processing routine. Therefore we
introduced the flag */
if (bDoInit == TRUE)
{
/* Call init routine */
Init(Parameter, OutputBuffer, OutputBuffer2, OutputBuffer3);
/* Reset init flag */
bDoInit = FALSE;
}
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* INPUT-DRIVEN modul implementation in the receiver -------------------- */
/* Check if enough data is available in the input buffer for processing */
if (InputBuffer.GetFillLevel() >= iInputBlockSize)
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
pvecOutputData2 = OutputBuffer2.QueryWriteBuffer();
pvecOutputData3 = OutputBuffer3.QueryWriteBuffer();
/* Call the underlying processing-routine */
ProcessDataThreadSave(Parameter);
/* Reset output-buffers if flag was set by processing routine */
if (bResetBuf == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf = FALSE;
OutputBuffer.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
if (bResetBuf2 == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf2 = FALSE;
OutputBuffer2.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer2.Put(iOutputBlockSize2);
}
if (bResetBuf3 == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf3 = FALSE;
OutputBuffer3.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer3.Put(iOutputBlockSize3);
}
}
return bEnoughData;
}
template<class TInput, class TOutput>
void CReceiverModul<TInput, TOutput>::
ReadData(CParameter& Parameter, CBuffer<TOutput>& OutputBuffer)
{
/* Check initialization flag. The initialization must be done OUTSIDE
the processing routine. This is ensured by doing it here, where we
have control of calling the processing routine. Therefore we
introduced the flag */
if (bDoInit == TRUE)
{
/* Call init routine */
Init(Parameter, OutputBuffer);
/* Reset init flag */
bDoInit = FALSE;
}
/* INPUT-DRIVEN modul implementation in the receiver -------------------- */
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
/* Call the underlying processing-routine */
ProcessDataThreadSave(Parameter);
/* Reset output-buffers if flag was set by processing routine */
if (bResetBuf == TRUE)
{
/* Reset flag and clear buffer */
bResetBuf = FALSE;
OutputBuffer.Clear();
}
else
{
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
}
template<class TInput, class TOutput>
_BOOLEAN CReceiverModul<TInput, TOutput>::
WriteData(CParameter& Parameter, CBuffer<TInput>& InputBuffer)
{
/* Check initialization flag. The initialization must be done OUTSIDE
the processing routine. This is ensured by doing it here, where we
have control of calling the processing routine. Therefore we
introduced the flag */
if (bDoInit == TRUE)
{
/* Call init routine */
Init(Parameter);
/* Reset init flag */
bDoInit = FALSE;
}
/* Special case if input block size is zero and buffer, too */
if ((InputBuffer.GetFillLevel() == 0) && (iInputBlockSize == 0))
{
InputBuffer.Clear();
return FALSE;
}
/* INPUT-DRIVEN modul implementation in the receiver -------------------- */
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* Check if enough data is available in the input buffer for processing */
if (InputBuffer.GetFillLevel() >= iInputBlockSize)
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Call the underlying processing-routine */
ProcessDataThreadSave(Parameter);
}
return bEnoughData;
}
/******************************************************************************\
* Simulation modul (CSimulationModul) *
\******************************************************************************/
template<class TInput, class TOutput, class TInOut2>
CSimulationModul<TInput, TOutput, TInOut2>::CSimulationModul()
{
/* Initialize all member variables with zeros */
iMaxOutputBlockSize2 = 0;
iOutputBlockSize2 = 0;
iInputBlockSize2 = 0;
pvecOutputData2 = NULL;
pvecInputData2 = NULL;
}
template<class TInput, class TOutput, class TInOut2>
void CSimulationModul<TInput, TOutput, TInOut2>::Init(CParameter& Parameter)
{
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter);
}
template<class TInput, class TOutput, class TInOut2>
void CSimulationModul<TInput, TOutput, TInOut2>::
Init(CParameter& Parameter,
CBuffer<TOutput>& OutputBuffer)
{
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter, OutputBuffer);
}
template<class TInput, class TOutput, class TInOut2>
void CSimulationModul<TInput, TOutput, TInOut2>::
Init(CParameter& Parameter,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TInOut2>& OutputBuffer2)
{
/* Init some internal variables */
iMaxOutputBlockSize2 = 0;
iOutputBlockSize2 = 0;
/* Init base-class */
CModul<TInput, TOutput>::Init(Parameter, OutputBuffer);
/* Init output transfer buffers */
if (iMaxOutputBlockSize2 != 0)
OutputBuffer2.Init(iMaxOutputBlockSize2);
else
{
if (iOutputBlockSize2 != 0)
OutputBuffer2.Init(iOutputBlockSize2);
}
}
template<class TInput, class TOutput, class TInOut2>
void CSimulationModul<TInput, TOutput, TInOut2>::
TransferData(CParameter& Parameter,
CBuffer<TInput>& InputBuffer,
CBuffer<TOutput>& OutputBuffer)
{
/* TransferData needed for simulation */
/* Check, if enough input data is available */
if (InputBuffer.GetFillLevel() < iInputBlockSize)
{
/* Set request flag */
InputBuffer.SetRequestFlag(TRUE);
return;
}
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
/* Call the underlying processing-routine */
ProcessDataInternal(Parameter);
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
template<class TInput, class TOutput, class TInOut2>
_BOOLEAN CSimulationModul<TInput, TOutput, TInOut2>::
ProcessDataIn(CParameter& Parameter,
CBuffer<TInput>& InputBuffer,
CBuffer<TInOut2>& InputBuffer2,
CBuffer<TOutput>& OutputBuffer)
{
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* Check if enough data is available in the input buffer for processing */
if ((InputBuffer.GetFillLevel() >= iInputBlockSize) &&
(InputBuffer2.GetFillLevel() >= iInputBlockSize2))
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
pvecInputData2 = InputBuffer2.Get(iInputBlockSize2);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
/* Copy extended data from FIRST input vector (definition!) */
(*pvecOutputData).SetExData((*pvecInputData).GetExData());
/* Call the underlying processing-routine */
ProcessDataInternal(Parameter);
/* Write processed data from internal memory in transfer-buffer */
OutputBuffer.Put(iOutputBlockSize);
}
return bEnoughData;
}
template<class TInput, class TOutput, class TInOut2>
_BOOLEAN CSimulationModul<TInput, TOutput, TInOut2>::
ProcessDataOut(CParameter& Parameter,
CBuffer<TInput>& InputBuffer,
CBuffer<TOutput>& OutputBuffer,
CBuffer<TInOut2>& OutputBuffer2)
{
/* This flag shows, if enough data was in the input buffer for processing */
_BOOLEAN bEnoughData = FALSE;
/* Check if enough data is available in the input buffer for processing */
if (InputBuffer.GetFillLevel() >= iInputBlockSize)
{
bEnoughData = TRUE;
/* Get vector from transfer-buffer */
pvecInputData = InputBuffer.Get(iInputBlockSize);
/* Query vector from output transfer-buffer for writing */
pvecOutputData = OutputBuffer.QueryWriteBuffer();
pvecOutputData2 = OutputBuffer2.QueryWriteBuffer();
/* Call the underlying processing-routine */
ProcessDataInternal(Parameter);
/* Write processed data from internal memory in transfer-buffers */
OutputBuffer.Put(iOutputBlockSize);
OutputBuffer2.Put(iOutputBlockSize2);
}
return bEnoughData;
}
#endif // !defined(AFX_MODUL_H__41E39CD3_2AEC_400E_907B_148C0EC17A43__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -