PrivateChat::PrivateChat(ReceiveEvent & event) { NetworkMessageReader & data = event.data(); PlayersList* g_playersList = PlayersList::instance(); QString chatUuid = data.string8(); m_owner = g_playersList->getPlayer(data.string8()); if (m_owner == NULL) { qWarning("New chat from an unknown player."); return; } if ((!PreferencesManager::getInstance()->value("isClient",true).toBool()) && (!sameLink(event.link()))) { qWarning("%s is usurpating chat %s", qPrintable(m_owner->name()), qPrintable(chatUuid)); return; } m_name = data.string16(); for (quint8 i = data.uint8() ; i > 0 ; i--) { QString uuid = data.string8(); m_set.insert(g_playersList->getPlayer(uuid)); } m_uuid = chatUuid; }
void EngineManager::loadRadio(RadioRepresentation rad) { //Set the current radio representation radioRep_ = rad; //Set the controller repositories in the ControllerManager controllerManager_.addRepository(reps_.contRepository); //Load the controllers vector<ControllerDescription> conts = rad.getControllers(); vector<ControllerDescription>::iterator contIt; for(contIt=conts.begin(); contIt!=conts.end(); ++contIt) { controllerManager_.loadController(contIt->type); } engineGraph_ = rad.getEngineGraph(); //Create the engines EngVertexIterator i, iend; for(b::tie(i,iend) = vertices(engineGraph_); i != iend; ++i) { //Get the engine description EngineDescription current = engineGraph_[*i]; //Add the engine to our vector engines_.push_back(createEngine(current)); } //Do a topological sort of the graph deque<unsigned> topoOrder; topological_sort(engineGraph_, front_inserter(topoOrder), b::vertex_index_map(b::identity_property_map())); //Go through graph in topological order and set buffers for(deque<unsigned>::iterator i = topoOrder.begin(); i != topoOrder.end(); ++i) { //Get input buffers vector< b::shared_ptr< DataBufferBase > > inputBuffers, outputBuffers; EngInEdgeIterator edgeIt, edgeItEnd; for(b::tie(edgeIt, edgeItEnd) = in_edges(*i, engineGraph_); edgeIt != edgeItEnd; ++edgeIt) { inputBuffers.push_back(engineGraph_[*edgeIt].theBuffer); } //Load the engine, passing in the input buffers outputBuffers = engines_[*i].loadEngine(engineGraph_[*i], inputBuffers); //Set the ouput buffers in the graph edges EngOutEdgeIterator outEdgeIt, outEdgeItEnd; for(b::tie(outEdgeIt, outEdgeItEnd) = out_edges(*i, engineGraph_); outEdgeIt != outEdgeItEnd; ++outEdgeIt) { for(vector< b::shared_ptr< DataBufferBase > >::iterator it = outputBuffers.begin(); it != outputBuffers.end(); ++it) { LinkDescription first = (*it)->getLinkDescription(); LinkDescription second = engineGraph_[*outEdgeIt]; if(sameLink(first, second)) { engineGraph_[*outEdgeIt].theBuffer = *it; engineGraph_[*outEdgeIt].theBuffer->setLinkDescription( second ); } } } } }