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; }
bool MMatchEventFactory::MakeEventList( const EventDataVec& EvnDataVec, EventPtrVec& EvnPtrVec ) { bool bIsComplete = true; MMatchEvent* pEvent; EventDataVec::const_iterator it, end; it = EvnDataVec.begin(); for( end = EvnDataVec.end(); it != end; ++it ) { if( !CheckUsableEventTimeByEndTime(it->End) ) continue; pEvent = CreateEvent( it->dwEventID ); if( 0 != pEvent ) { if( pEvent->InitEvent() ) { pEvent->Set( it->dwEventListID, it->EventType, it->dwGameType, it->dwElapsedTime, it->dwPercent, it->dwRate, it->Start, it->End, it->strName, it->strAnnounce, it->fXPBonusRatio, it->fBPBonusRatio, it->EventPartTimeVec ); EvnPtrVec.push_back( pEvent ); pEvent = 0; } else { mlog( "MMatchEventFactory::MakeEventList - Init실패. ID:%u Name:%s.\n", pEvent->GetEventID(), pEvent->GetName().c_str() ); delete pEvent; pEvent = 0; bIsComplete = false; } } else bIsComplete = false; } return bIsComplete; }