void Robot::CommandProc() { ChannelMap::iterator iter = m_commandReceivingChannels.begin(); ChannelMap::iterator end = m_commandReceivingChannels.end(); for (; iter != end; iter++) { RobotCommandBase* cmdBase[2]; euint size = 0; RWBuffer channel = iter->second; while (RWBuffer_Read(channel, (euint*)cmdBase, &size)) { if (size >= sizeof(RobotCommandBase*)) { RobotCommand* cmd = cmdBase[0]->DynamicCast<RobotCommand>(); if (cmd) { CommandProcImpl(iter->first, cmd); delete cmd; break; } RobotCommandReceipt* rec = cmdBase[0]->DynamicCast<RobotCommandReceipt>(); if (rec) { CommandReceiptProcImpl(iter->first, rec); delete rec; } } } } }
void Robot::CommandProc() { ChannelMap::iterator iter = m_commandReceivingChannels.begin(); ChannelMap::iterator end = m_commandReceivingChannels.end(); for (; iter != end; iter++) { euint size = 0; SafedBuffer* channel = iter->second; char* ret = NULL; while ( (ret = channel->Read(&size)) ) ///if ( (ret = channel->Read(&size)) ) { #ifdef USE_COMMAND_PTR RobotCommandBase* rcb = *((RobotCommandBase**)ret); RobotCommand* cmd = rcb->DynamicCast<RobotCommand>(); if (cmd) { CommandProcImpl(iter->first, cmd); delete rcb; continue; } RobotCommandReceipt* rec = rcb->DynamicCast<RobotCommandReceipt>(); if (rec) { CommandReceiptProcImpl(iter->first, rec); delete rcb; } #else RobotCommandBase* rcb = (RobotCommandBase*)ret; RobotCommand* cmd = rcb->DynamicCast<RobotCommand>(); if (cmd) { if (!CommandProcImpl(iter->first, cmd)) break; continue; } RobotCommandReceipt* rec = rcb->DynamicCast<RobotCommandReceipt>(); if (rec) { if (!CommandReceiptProcImpl(iter->first, rec)) break; } #endif } } }