Created
March 10, 2015 01:56
-
-
Save eventhelix/d699f9141996875dd159 to your computer and use it in GitHub Desktop.
Delegate work to the DSP class http://www.eventhelix.com/realtimemantra/object_oriented/object_design_tips_2.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DSP | |
{ | |
public: | |
void WriteBuffer(Buffer *pBuf); | |
Buffer *ReadBuffer(); | |
}; | |
Status MessageHandler::SendMessage(Buffer *) | |
{ | |
int dspId = pBuffer->GetDSP(); | |
pDSP = m_dsp[dspId]; | |
int status = pDSP->WriteBuffer(); | |
return status; | |
} | |
Status DSP::WriteBuffer(Buffer *) | |
{ | |
int status = m_pQueue->Add(pBuffer); | |
IOWrite(WRITTEN_MESSAGE); | |
if (m_pQueue->GetLength() > CONGESTION_THRESHOLD) | |
{ | |
m_bCongestionFlag = true; | |
} | |
return status; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment