void Transmitter::set_topic() { TopicQos topic_qos; ReturnCode_t retcode = participant()->get_default_topic_qos(topic_qos); participant().check(retcode, "Participant::get_default_topic_qos"); stringstream topic_name; switch (m_def.topic_kind) { case RELIABLE: topic_qos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; topic_name << "ThroughputTopic_" << m_def.topic_id << "_R"; break; case TRANSIENT: topic_qos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; topic_qos.durability.kind = DDS::TRANSIENT_DURABILITY_QOS; topic_name << "ThroughputTopic_" << m_def.topic_id << "_T"; break; case PERSISTENT: topic_qos.durability.kind = DDS::PERSISTENT_DURABILITY_QOS; topic_name << "ThroughputTopic_" << m_def.topic_id << "_P"; break; case BEST_EFFORT: topic_name << "ThroughputTopic_" << m_def.topic_id << "_B"; break; } m_topic.create(topic_name.str().c_str(), topic_qos); }
Transmitter::Transmitter(Partition& partition) : m_partition(partition), m_qos_query(qos_reader()), m_topic(participant()), m_writer(publisher(), m_topic), m_writer_thread(*this), m_active(false), m_config_number(0) { // cout << "Transmitter::Transmitter(" << partition_id() << ")" << endl; }
void DDSApp::determine_participant(DDS::DomainParticipant_var& part) { if (part.in()) return; if (!default_participant_.in()) { // this will create a participant and assign the default participant participant(); } part = default_participant_; }
Transceiver::Transceiver(Partition& partition) : m_partition(partition), m_qos_query(qos_reader()), m_dispatcher(*this), m_topic(participant()), m_writer(publisher(), m_topic), m_echo_topic(participant()), m_reader(subscriber(), m_echo_topic), m_reader_condition(m_reader), m_reader_attachment(m_dispatcher, m_reader_condition), m_writer_thread(*this), m_reader_thread(*this), m_report_thread(*this), m_writer_active(false), m_reader_active(false), m_report_active(false), m_config_number(0) { // cout << "Transceiver::Transceiver(" << partition_id() << ")" << endl; }
ParticipantPtr ParticipantManager::addParticipant( const util::unique_id participant_id, rtsp::SessionPtr session) { boost::unique_lock<boost::mutex> lock(m_participant_map_mutex); ParticipantPtr participant(new Participant(participant_id, this, session, m_worker, m_rtsp_parser_manager)); m_participant_map[participant_id] = participant; return participant; }
std::vector<Poco::SharedPtr<ContactData> > ConvManagerService::getParticipants() { std::vector<Poco::SharedPtr<ContactData> >contacts; ParticipantRefs participants; m_conversation->GetParticipants(participants, Conversation::OTHER_CONSUMERS); unsigned int size = participants.size(); for (unsigned int i = 0; i < size; ++i) { // Get the SkypeParticipant. SkypeParticipant::Ref participant(participants[i]); if (m_conversationMode == Call) { // If the participant is live, add it to the list. if (participant->isLive()) { // Get the contact for this participant. SkypeContact::Ref contact = Util::contactFromParticipant(participant); // Convert contact in ContactData structure. Poco::SharedPtr<ContactData> newData(Util::dataFromContact(contact)); // Add to the container. contacts.push_back(newData); } } else { // m_conversationMode == Chat. SkypeContact::Ref contact = Util::contactFromParticipant(participant); // Convert contact in ContactData structure. Poco::SharedPtr<ContactData> newData(Util::dataFromContact(contact)); // Add to the container. contacts.push_back(newData); } } return contacts; }
int main(int argc, char** argv) { // see if we can initialise the mpi library this is always the first // thing that we must do at the start of an MPI program MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &world_size); MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); if(world_rank == 0) coordinator(); else participant(); MPI_Finalize(); return 0; }
static const participant bye() { return participant(":BYE:BYE:"); }
///Parse a line in a Parameter file. void ribi::gtst::Parameters::Parse(const std::string& s) { if (s.empty()) return; if (s.size() > 0 && s.substr(0,1) == "#") return; if (s.size() > 1 && s.substr(0,2) == "//") return; ///Parameters starting with finished_ are parsed by ParametersFinished if (s.size() > 9 && s.substr(0,9) == "finished_") { const std::string t = s.substr(9,s.size()-9); this->GetFinished()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersGroupReAssign if (s.size() > 13 && s.substr(0,13) == "group_assign_") { const std::string t = s.substr(13,s.size()-13); this->GetGroupAssign()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersGroupReAssign if (s.size() > 15 && s.substr(0,15) == "group_reassign_") { const std::string t = s.substr(15,s.size()-15); this->GetGroupReAssign()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersGroupReAssign if (s.size() > 14 && s.substr(0,14) == "assign_payoff_") { const std::string t = s.substr(14,s.size()-14); this->GetAssignPayoff()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup if (s.size() > 20 && s.substr(0,20) == "view_results_voting_") { const std::string t = s.substr(20,s.size()-20); this->GetViewResultsVoting()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup if (s.size() > 19 && s.substr(0,19) == "view_results_group_") { const std::string t = s.substr(19,s.size()-19); this->GetViewResultsGroup()->Parse(t); return; } ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup if (s.size() > 14 && s.substr(0,14) == "assign_payoff_") { const std::string t = s.substr(14,s.size()-14); this->GetAssignPayoff()->Parse(t); return; } if (s.size() > 14 && s.substr(0,14) == "choose_action_") { const std::string t = s.substr(14,s.size()-14); this->GetChooseAction()->Parse(t); return; } if (s.size() > 5 && s.substr(0,5) == "chat_") { const std::string t = s.substr(5,s.size()-5); this->GetChat()->Parse(t); return; } if (s.size() > 7 && s.substr(0,7) == "voting_") { const std::string t = s.substr(7,s.size()-7); this->GetVoting()->Parse(t); return; } //Participants if (s.size() > 12 && s.substr(0,12) == "participant=") { const std::string t = s.substr(12,s.size() - 12); const std::vector<std::string> v = SeperateString(t,','); if (v.size() != 2) { throw std::runtime_error((std::string("Incorrectly formed participant line: ") + s).c_str());; } assert(v.size() == 2 && "Participant must have two elements"); boost::shared_ptr<GroupAssigner> group_assigner = GroupAssigner::CreateAssigner(v[0]); const std::string ip_address_str = v[1]; boost::shared_ptr<Participant> participant( new Participant(group_assigner,m_server) ); if (ip_address_str!="*") { try { boost::shared_ptr<SafeIpAddress> ip_address(new SafeIpAddress(ip_address_str)); participant->SetIpAddress(ip_address); } catch (std::logic_error&) { throw std::runtime_error((std::string("Incorrectly formed IP address: ") + ip_address_str).c_str()); } } m_participants.push_back(participant); return; } throw std::runtime_error((std::string("Unparsable parameter file line: ") + s).c_str()); }