Skip to content

Commit

Permalink
Merge pull request eProsima#68 from Karsten1987/get_participant_names
Browse files Browse the repository at this point in the history
(dev) expose getParticipantNames function in API
  • Loading branch information
richiprosima authored Jan 24, 2017
2 parents f052081 + a394967 commit 462c6ae
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/fastrtps/participant/Participant.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class RTPS_DllAPI Participant {
* */
std::pair<StatefulReader*,StatefulReader*> getEDPReaders();

std::vector<std::string> getParticipantNames();

/**
* This method returns the number of Publishers that currently belong to the Participant that have
* a given topic name
Expand Down
2 changes: 2 additions & 0 deletions include/fastrtps/rtps/participant/RTPSParticipant.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class RTPS_DllAPI RTPSParticipant
*/
std::pair<StatefulReader*,StatefulReader*> getEDPReaders();

std::vector<std::string> getParticipantNames();

/**
* Get a copy of the actual state of the RTPSParticipantParameters
* @return RTPSParticipantAttributes copy of the params.
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/participant/Participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ std::pair<StatefulReader*,StatefulReader*> Participant::getEDPReaders(){
return mp_impl->getEDPReaders();
}

std::vector<std::string> Participant::getParticipantNames(){
return mp_impl->getParticipantNames();
}

int Participant::get_no_publishers(char *target_topic){
return mp_impl->get_no_publishers(target_topic);
}
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/participant/ParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ std::pair<StatefulReader*,StatefulReader*> ParticipantImpl::getEDPReaders(){
return mp_rtpsParticipant->getEDPReaders();
}

std::vector<std::string> ParticipantImpl::getParticipantNames(){
return mp_rtpsParticipant->getParticipantNames();
}

int ParticipantImpl::get_no_publishers(char *target_topic){
int count = 0;
std::string target_string(target_topic);
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/participant/ParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class ParticipantImpl

std::pair<StatefulReader*,StatefulReader*> getEDPReaders();

std::vector<std::string> getParticipantNames();

int get_no_publishers(char *target_topic);
int get_no_subscribers(char *target_topic);
/**
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ std::pair<StatefulReader*,StatefulReader*> RTPSParticipant::getEDPReaders(){
return mp_impl->getEDPReaders();
}

std::vector<std::string> RTPSParticipant::getParticipantNames(){
return mp_impl->getParticipantNames();
}

RTPSParticipantAttributes RTPSParticipant::getRTPSParticipantAttributes(){
return mp_impl->getRTPSParticipantAttributes();
}
Expand Down
13 changes: 13 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include <fastrtps/rtps/builtin/BuiltinProtocols.h>
#include <fastrtps/rtps/builtin/discovery/participant/PDPSimple.h>
#include <fastrtps/rtps/builtin/data/ParticipantProxyData.h>

#include <fastrtps/utils/IPFinder.h>
#include <fastrtps/utils/eClock.h>
Expand Down Expand Up @@ -789,6 +790,18 @@ std::pair<StatefulReader*,StatefulReader*> RTPSParticipantImpl::getEDPReaders(){

}

std::vector<std::string> RTPSParticipantImpl::getParticipantNames(){
std::vector<std::string> participant_names;
auto pdp = mp_builtinProtocols->mp_PDP;
for (auto it = pdp->ParticipantProxiesBegin();
it != pdp->ParticipantProxiesEnd();
++it)
{
participant_names.emplace_back((*it)->m_participantName);
}
return participant_names;
}

void RTPSParticipantImpl::sendSync(CDRMessage_t* msg, Endpoint *pend, const Locator_t& destination_loc)
{
boost::lock_guard<boost::mutex> guard(m_send_resources_mutex);
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ class RTPSParticipantImpl
*/
std::pair<StatefulReader*,StatefulReader*> getEDPReaders();

std::vector<std::string> getParticipantNames();

/**
* Get the participant
* @return participant
Expand Down

0 comments on commit 462c6ae

Please sign in to comment.