bool MMatchEventFactory::InsertEventData( const EventData& EvnData ) { if( (MMatchEvent::GAME_TYPE_ALL != EvnData.dwGameType) && ((0 > EvnData.dwGameType) && (8 < EvnData.dwGameType)) ) return false; if( MMatchEvent::GAME_TYPE_ALL == EvnData.dwGameType ) m_vAllGameTypeEventData.push_back( EvnData ); else { GameTypeEventMap::iterator itGameType = m_mGameTypeEvent.find( EvnData.dwGameType ); if( m_mGameTypeEvent.end() == itGameType ) { EventDataVec edv; edv.push_back( EvnData ); m_mGameTypeEvent.insert( GameTypeEventMap::value_type(EvnData.dwGameType, edv) ); } else itGameType->second.push_back( EvnData ); return true; } return false; }
EventDataVec GPIO_Interrupt::Read() { char buffer; EventDataVec eventData; lseek(_fd, 0, SEEK_SET); if (read(_fd, &buffer, 1) == 1) eventData.push_back(EventData(buffer)); return eventData; }
// Read one new-line or null delimited message from the named pipe EventDataVec CommandPipe::Read() { char buffer; EventDataVec eventData; std::string command; lseek(_readFd, 0, SEEK_SET); while (read(_readFd, &buffer, 1) == 1) { if (buffer == '\n' || buffer == '\0') break; else command.push_back(buffer); } eventData.push_back(EventData(command)); return eventData; }