#include "modulecomm.h" #include namespace iv { namespace modulecomm { struct ModeduleInfo { void * mphandle; ModuleComm_TYPE mmctype; }; void * RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount, ModuleComm_TYPE xmctype,const unsigned short nport) { iv::modulecomm::ModeduleInfo * pmi = new iv::modulecomm::ModeduleInfo; pmi->mmctype = xmctype; pmi->mphandle = 0; switch (xmctype) { case ModuleComm_SHAREMEM: pmi->mphandle = iv::modulecomm_shm::RegisterSend(strcommname,nBufSize,nMsgBufCount); break; case ModuleComm_FASTRTPS: pmi->mphandle = iv::modulecomm_fastrtps::RegisterSend(strcommname,nBufSize,nMsgBufCount); break; case ModuleComm_INTERIOR: pmi->mphandle = iv::modulecomm_inter::RegisterSend(strcommname,nBufSize,nMsgBufCount); break; case ModuleComm_FASTRTPS_TCP: pmi->mphandle = iv::modulecomm_fastrtps_tcp::RegisterSend(strcommname,nBufSize,nMsgBufCount,nport); break; default: break; } return pmi; } void * RegisterRecv(const char * strcommname,SMCallBack pCall,ModuleComm_TYPE xmctype,const char * strip, const unsigned short nPort) { iv::modulecomm::ModeduleInfo * pmi = new iv::modulecomm::ModeduleInfo; pmi->mmctype = xmctype; pmi->mphandle = 0; switch (xmctype) { case ModuleComm_SHAREMEM: pmi->mphandle = iv::modulecomm_shm::RegisterRecv(strcommname,pCall); break; case ModuleComm_FASTRTPS: pmi->mphandle = iv::modulecomm_fastrtps::RegisterRecv(strcommname,pCall); break; case ModuleComm_INTERIOR: pmi->mphandle = iv::modulecomm_inter::RegisterRecv(strcommname,pCall); break; case ModuleComm_FASTRTPS_TCP: pmi->mphandle = iv::modulecomm_fastrtps_tcp::RegisterRecv(strcommname,pCall,strip,nPort); break; default: break; } return pmi; } void * RegisterRecvPlus(const char * strcommname,ModuleFun xFun, ModuleComm_TYPE xmctype,const char * strip, const unsigned short nPort) { iv::modulecomm::ModeduleInfo * pmi = new iv::modulecomm::ModeduleInfo; pmi->mmctype = xmctype; pmi->mphandle = 0; switch (xmctype) { case ModuleComm_SHAREMEM: pmi->mphandle = iv::modulecomm_shm::RegisterRecvPlus(strcommname,xFun); break; case ModuleComm_FASTRTPS: pmi->mphandle = iv::modulecomm_fastrtps::RegisterRecvPlus(strcommname,xFun); break; case ModuleComm_INTERIOR: pmi->mphandle = iv::modulecomm_inter::RegisterRecvPlus(strcommname,xFun); break; case ModuleComm_FASTRTPS_TCP: pmi->mphandle = iv::modulecomm_fastrtps_tcp::RegisterRecvPlus(strcommname,xFun,strip,nPort); break; default: break; } return pmi; } void ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen) { iv::modulecomm::ModeduleInfo * pmi = (iv::modulecomm::ModeduleInfo * )pHandle; switch (pmi->mmctype) { case ModuleComm_SHAREMEM: iv::modulecomm_shm::ModuleSendMsg(pmi->mphandle,strdata,nDataLen); break; case ModuleComm_FASTRTPS: iv::modulecomm_fastrtps::ModuleSendMsg(pmi->mphandle,strdata,nDataLen); break; case ModuleComm_INTERIOR: iv::modulecomm_inter::ModuleSendMsg(pmi->mphandle,strdata,nDataLen); break; case ModuleComm_FASTRTPS_TCP: iv::modulecomm_fastrtps_tcp::ModuleSendMsg(pmi->mphandle,strdata,nDataLen); break; default: break; } } void Unregister(void * pHandle) { iv::modulecomm::ModeduleInfo * pmi = (iv::modulecomm::ModeduleInfo * )pHandle; switch (pmi->mmctype) { case ModuleComm_SHAREMEM: iv::modulecomm_shm::Unregister(pmi->mphandle); break; case ModuleComm_FASTRTPS: iv::modulecomm_fastrtps::Unregister(pmi->mphandle); break; case ModuleComm_INTERIOR: iv::modulecomm_inter::Unregister(pmi->mphandle); break; case ModuleComm_FASTRTPS_TCP: iv::modulecomm_fastrtps_tcp::Unregister(pmi->mphandle); break; default: break; } } void PauseComm(void *pHandle) { iv::modulecomm::ModeduleInfo * pmi = (iv::modulecomm::ModeduleInfo * )pHandle; switch (pmi->mmctype) { case ModuleComm_SHAREMEM: iv::modulecomm_shm::PauseComm(pmi->mphandle); break; case ModuleComm_FASTRTPS: iv::modulecomm_fastrtps::PauseComm(pmi->mphandle); break; case ModuleComm_INTERIOR: iv::modulecomm_inter::PauseComm(pmi->mphandle); break; case ModuleComm_FASTRTPS_TCP: iv::modulecomm_fastrtps_tcp::PauseComm(pmi->mphandle); break; default: break; } } void ContintuComm(void *pHandle) { iv::modulecomm::ModeduleInfo * pmi = (iv::modulecomm::ModeduleInfo * )pHandle; switch (pmi->mmctype) { case ModuleComm_SHAREMEM: iv::modulecomm_shm::ContintuComm(pmi->mphandle); break; case ModuleComm_FASTRTPS: iv::modulecomm_fastrtps::ContintuComm(pmi->mphandle); break; case ModuleComm_INTERIOR: iv::modulecomm_inter::ContintuComm(pmi->mphandle); break; case ModuleComm_FASTRTPS_TCP: iv::modulecomm_fastrtps_tcp::ContintuComm(pmi->mphandle); break; default: break; } } } }