Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified getAttributes behaviour. #262

Merged
merged 1 commit into from
Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions include/fastrtps/publisher/Publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class PublisherImpl;
* Class Publisher, used to send data to associated subscribers.
* @ingroup FASTRTPS_MODULE
*/
class RTPS_DllAPI Publisher {
class RTPS_DllAPI Publisher
{
friend class PublisherImpl;
virtual ~Publisher();

public:

Publisher(PublisherImpl* pimpl);

/**
Expand Down Expand Up @@ -94,7 +97,7 @@ class RTPS_DllAPI Publisher {
*/
bool removeAllChange(size_t* removed = nullptr);

bool wait_for_all_acked(const rtps::Time_t& max_wait);
bool wait_for_all_acked(const rtps::Time_t& max_wait);

/**
* Get the GUID_t of the associated RTPSWriter.
Expand All @@ -106,7 +109,7 @@ class RTPS_DllAPI Publisher {
* Get the Attributes of the Publisher.
* @return Attributes of the publisher
*/
PublisherAttributes getAttributes() const;
const PublisherAttributes& getAttributes() const;

private:
PublisherImpl* mp_impl;
Expand Down
17 changes: 7 additions & 10 deletions include/fastrtps/rtps/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,16 @@ class Endpoint
{
friend class RTPSParticipantImpl;

protected:

protected:
Endpoint(RTPSParticipantImpl* pimpl,GUID_t& guid,EndpointAttributes& att);

virtual ~Endpoint();

public:

public:
/**
* Get associated GUID
* @return Associated GUID
*/
RTPS_DllAPI inline const GUID_t& getGuid() const { return m_guid; };
RTPS_DllAPI inline const GUID_t& getGuid() const { return m_guid; }

/**
* Get mutex
Expand All @@ -70,12 +67,13 @@ class Endpoint
* Get associated attributes
* @return Endpoint attributes
*/
RTPS_DllAPI inline EndpointAttributes* getAttributes() { return &m_att; }
RTPS_DllAPI inline EndpointAttributes& getAttributes() { return m_att; }

#if HAVE_SECURITY
bool supports_rtps_protection() { return supports_rtps_protection_; }
#endif
protected:

protected:
//!Pointer to the RTPSParticipant containing this endpoint.
RTPSParticipantImpl* mp_RTPSParticipant;
//!Endpoint GUID
Expand All @@ -85,8 +83,7 @@ class Endpoint
//!Endpoint Mutex
std::recursive_mutex* mp_mutex;

private:

private:
Endpoint& operator=(const Endpoint&) = delete;

#if HAVE_SECURITY
Expand Down
13 changes: 6 additions & 7 deletions include/fastrtps/subscriber/Subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class SampleInfo_t;
class RTPS_DllAPI Subscriber
{
friend class SubscriberImpl;
virtual ~Subscriber(){};
public:
virtual ~Subscriber(){}

public:
/**
* @param pimpl Actual implementation of the subscriber
*/
Subscriber(SubscriberImpl* pimpl):mp_impl(pimpl){};

Subscriber(SubscriberImpl* pimpl) : mp_impl(pimpl) {}

/**
* Get the associated GUID
Expand Down Expand Up @@ -86,7 +86,7 @@ class RTPS_DllAPI Subscriber
* Get the Attributes of the Subscriber.
* @return Attributes of the subscriber
*/
SubscriberAttributes getAttributes() const;
const SubscriberAttributes& getAttributes() const;

/*!
* @brief Returns there is a clean state with all Publishers.
Expand All @@ -102,8 +102,7 @@ class RTPS_DllAPI Subscriber
*/
uint64_t getUnreadCount() const;

private:

private:
SubscriberImpl* mp_impl;
};

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/publisher/Publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const GUID_t& Publisher::getGuid()
return mp_impl->getGuid();
}

PublisherAttributes Publisher::getAttributes() const
const PublisherAttributes& Publisher::getAttributes() const
{
return mp_impl->getAttributes();
}
26 changes: 13 additions & 13 deletions src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ bool EDP::newLocalReaderProxyData(RTPSReader* reader, TopicAttributes& att, Read
rpd.m_expectsInlineQos = reader->expectsInlineQos();
rpd.guid(reader->getGuid());
rpd.key() = rpd.guid();
rpd.multicastLocatorList(reader->getAttributes()->multicastLocatorList);
rpd.unicastLocatorList(reader->getAttributes()->unicastLocatorList);
rpd.multicastLocatorList(reader->getAttributes().multicastLocatorList);
rpd.unicastLocatorList(reader->getAttributes().unicastLocatorList);
rpd.RTPSParticipantKey() = mp_RTPSParticipant->getGuid();
rpd.topicName(att.getTopicName());
rpd.typeName(att.getTopicDataType());
rpd.topicKind(att.getTopicKind());
rpd.m_qos = rqos;
rpd.userDefinedId(reader->getAttributes()->getUserDefinedID());
rpd.userDefinedId(reader->getAttributes().getUserDefinedID());
reader->m_acceptMessagesFromUnkownWriters = false;

//ADD IT TO THE LIST OF READERPROXYDATA
Expand All @@ -96,16 +96,16 @@ bool EDP::newLocalWriterProxyData(RTPSWriter* writer,TopicAttributes& att, Write
wpd.isAlive(true);
wpd.guid(writer->getGuid());
wpd.key() = wpd.guid();
wpd.multicastLocatorList(writer->getAttributes()->multicastLocatorList);
wpd.unicastLocatorList(writer->getAttributes()->unicastLocatorList);
wpd.multicastLocatorList(writer->getAttributes().multicastLocatorList);
wpd.unicastLocatorList(writer->getAttributes().unicastLocatorList);
wpd.RTPSParticipantKey() = mp_RTPSParticipant->getGuid();
wpd.topicName(att.getTopicName());
wpd.typeName(att.getTopicDataType());
wpd.topicKind(att.getTopicKind());
wpd.typeMaxSerialized(writer->getTypeMaxSerialized());
wpd.m_qos = wqos;
wpd.userDefinedId(writer->getAttributes()->getUserDefinedID());
wpd.persistence_guid(writer->getAttributes()->persistence_guid);
wpd.userDefinedId(writer->getAttributes().getUserDefinedID());
wpd.persistence_guid(writer->getAttributes().persistence_guid);

//ADD IT TO THE LIST OF READERPROXYDATA
ParticipantProxyData pdata;
Expand Down Expand Up @@ -422,7 +422,7 @@ bool EDP::pairingReader(RTPSReader* R, const ParticipantProxyData& pdata, const
{
#if HAVE_SECURITY
if(!mp_RTPSParticipant->security_manager().discovered_writer(R->m_guid, (*pit)->m_guid,
**wdatait, R->getAttributes()->security_attributes()))
**wdatait, R->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for reader " << R->getGuid());
}
Expand Down Expand Up @@ -486,7 +486,7 @@ bool EDP::pairingWriter(RTPSWriter* W, const ParticipantProxyData& pdata, const
{
#if HAVE_SECURITY
if(!mp_RTPSParticipant->security_manager().discovered_reader(W->getGuid(), (*pit)->m_guid,
**rdatait, W->getAttributes()->security_attributes()))
**rdatait, W->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " << W->getGuid());
}
Expand Down Expand Up @@ -552,7 +552,7 @@ bool EDP::pairing_reader_proxy_with_any_local_writer(ParticipantProxyData* pdata
{
#if HAVE_SECURITY
if(!mp_RTPSParticipant->security_manager().discovered_reader(writerGUID, pdata->m_guid,
*rdata, (*wit)->getAttributes()->security_attributes()))
*rdata, (*wit)->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " << writerGUID);
}
Expand Down Expand Up @@ -620,7 +620,7 @@ bool EDP::pairing_reader_proxy_with_local_writer(const GUID_t& local_writer, con
if(valid)
{
if(!mp_RTPSParticipant->security_manager().discovered_reader(writerGUID,
remote_participant_guid, rdata, (*wit)->getAttributes()->security_attributes()))
remote_participant_guid, rdata, (*wit)->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " << writerGUID);
}
Expand Down Expand Up @@ -710,7 +710,7 @@ bool EDP::pairing_writer_proxy_with_any_local_reader(ParticipantProxyData *pdata
{
#if HAVE_SECURITY
if(!mp_RTPSParticipant->security_manager().discovered_writer(readerGUID, pdata->m_guid,
*wdata, (*rit)->getAttributes()->security_attributes()))
*wdata, (*rit)->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for reader " << readerGUID);
}
Expand Down Expand Up @@ -778,7 +778,7 @@ bool EDP::pairing_writer_proxy_with_local_reader(const GUID_t& local_reader, con
if(valid)
{
if(!mp_RTPSParticipant->security_manager().discovered_writer(readerGUID,
remote_participant_guid, wdata, (*rit)->getAttributes()->security_attributes()))
remote_participant_guid, wdata, (*rit)->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for reader " << readerGUID);
}
Expand Down
16 changes: 8 additions & 8 deletions src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ bool EDPSimple::processLocalReaderProxyData(RTPSReader* local_reader, ReaderProx
auto* reader = &mp_SubReader;

#if HAVE_SECURITY
if(local_reader->getAttributes()->security_attributes().is_discovered_protected)
if(local_reader->getAttributes().security_attributes().is_discovered_protected)
{
writer = &sedp_builtin_subscriptions_secure_writer_;
reader = &sedp_builtin_subscriptions_secure_reader_;
Expand Down Expand Up @@ -507,7 +507,7 @@ bool EDPSimple::processLocalWriterProxyData(RTPSWriter* local_writer, WriterProx
auto* reader = &mp_PubReader;

#if HAVE_SECURITY
if(local_writer->getAttributes()->security_attributes().is_discovered_protected)
if(local_writer->getAttributes().security_attributes().is_discovered_protected)
{
writer = &sedp_builtin_publications_secure_writer_;
reader = &sedp_builtin_publications_secure_reader_;
Expand Down Expand Up @@ -568,7 +568,7 @@ bool EDPSimple::removeLocalWriter(RTPSWriter* W)
auto* reader = &mp_PubReader;

#if HAVE_SECURITY
if(W->getAttributes()->security_attributes().is_discovered_protected)
if(W->getAttributes().security_attributes().is_discovered_protected)
{
writer = &sedp_builtin_publications_secure_writer_;
reader = &sedp_builtin_publications_secure_reader_;
Expand Down Expand Up @@ -613,7 +613,7 @@ bool EDPSimple::removeLocalReader(RTPSReader* R)
auto* reader = &mp_SubReader;

#if HAVE_SECURITY
if(R->getAttributes()->security_attributes().is_discovered_protected)
if(R->getAttributes().security_attributes().is_discovered_protected)
{
writer = &sedp_builtin_subscriptions_secure_writer_;
reader = &sedp_builtin_subscriptions_secure_reader_;
Expand Down Expand Up @@ -741,7 +741,7 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata)
watt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS;
if(!mp_RTPSParticipant->security_manager().discovered_builtin_writer(
sedp_builtin_publications_secure_reader_.first->getGuid(), pdata.m_guid, watt,
sedp_builtin_publications_secure_reader_.first->getAttributes()->security_attributes()))
sedp_builtin_publications_secure_reader_.first->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " <<
sedp_builtin_publications_secure_reader_.first->getGuid());
Expand All @@ -764,7 +764,7 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata)
ratt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
if(!mp_RTPSParticipant->security_manager().discovered_builtin_reader(
sedp_builtin_publications_secure_writer_.first->getGuid(), pdata.m_guid, ratt,
sedp_builtin_publications_secure_writer_.first->getAttributes()->security_attributes()))
sedp_builtin_publications_secure_writer_.first->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " <<
sedp_builtin_publications_secure_writer_.first->getGuid());
Expand All @@ -787,7 +787,7 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata)
watt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS;
if(!mp_RTPSParticipant->security_manager().discovered_builtin_writer(
sedp_builtin_subscriptions_secure_reader_.first->getGuid(), pdata.m_guid, watt,
sedp_builtin_subscriptions_secure_reader_.first->getAttributes()->security_attributes()))
sedp_builtin_subscriptions_secure_reader_.first->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " <<
sedp_builtin_subscriptions_secure_reader_.first->getGuid());
Expand All @@ -811,7 +811,7 @@ void EDPSimple::assignRemoteEndpoints(const ParticipantProxyData& pdata)
ratt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
if(!mp_RTPSParticipant->security_manager().discovered_builtin_reader(
sedp_builtin_subscriptions_secure_writer_.first->getGuid(), pdata.m_guid, ratt,
sedp_builtin_subscriptions_secure_writer_.first->getAttributes()->security_attributes()))
sedp_builtin_subscriptions_secure_writer_.first->getAttributes().security_attributes()))
{
logError(RTPS_EDP, "Security manager returns an error for writer " <<
sedp_builtin_subscriptions_secure_writer_.first->getGuid());
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool EDPStatic::removeLocalReader(RTPSReader* R)
{
if(staticproperty.m_entityId == R->getGuid().entityId)
{
*pit = EDPStaticProperty::toProperty("Reader","ENDED",R->getAttributes()->getUserDefinedID(),
*pit = EDPStaticProperty::toProperty("Reader","ENDED",R->getAttributes().getUserDefinedID(),
R->getGuid().entityId);
}
}
Expand All @@ -158,7 +158,7 @@ bool EDPStatic::removeLocalWriter(RTPSWriter*W)
{
if(staticproperty.m_entityId == W->getGuid().entityId)
{
*pit = EDPStaticProperty::toProperty("Writer","ENDED",W->getAttributes()->getUserDefinedID(),
*pit = EDPStaticProperty::toProperty("Writer","ENDED",W->getAttributes().getUserDefinedID(),
W->getGuid().entityId);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool PDPSimple::initPDP(RTPSParticipantImpl* part)
if(!createSPDPEndpoints())
return false;
//UPDATE METATRAFFIC.
mp_builtin->updateMetatrafficLocators(this->mp_SPDPReader->getAttributes()->unicastLocatorList);
mp_builtin->updateMetatrafficLocators(this->mp_SPDPReader->getAttributes().unicastLocatorList);
m_participantProxies.push_back(new ParticipantProxyData());
initializeParticipantProxyData(m_participantProxies.front());

Expand Down Expand Up @@ -798,7 +798,7 @@ void PDPSimple::assertRemoteWritersLiveliness(GuidPrefix_t& guidP,LivelinessQosP
for(std::vector<RTPSReader*>::iterator rit = mp_RTPSParticipant->userReadersListBegin();
rit!=mp_RTPSParticipant->userReadersListEnd();++rit)
{
if((*rit)->getAttributes()->reliabilityKind == RELIABLE)
if((*rit)->getAttributes().reliabilityKind == RELIABLE)
{
StatefulReader* sfr = (StatefulReader*)(*rit);
WriterProxy* WP;
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/rtps/messages/MessageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ MessageReceiver::~MessageReceiver()
void MessageReceiver::associateEndpoint(Endpoint *to_add){
bool found = false;
std::lock_guard<std::mutex> guard(mtx);
if(to_add->getAttributes()->endpointKind == WRITER)
if(to_add->getAttributes().endpointKind == WRITER)
{
for(auto it = AssociatedWriters.begin(); it != AssociatedWriters.end(); ++it)
{
Expand Down Expand Up @@ -116,7 +116,7 @@ void MessageReceiver::associateEndpoint(Endpoint *to_add){
void MessageReceiver::removeEndpoint(Endpoint *to_remove){

std::lock_guard<std::mutex> guard(mtx);
if(to_remove->getAttributes()->endpointKind == WRITER){
if(to_remove->getAttributes().endpointKind == WRITER){
RTPSWriter* var = (RTPSWriter *)to_remove;
for(auto it=AssociatedWriters.begin(); it !=AssociatedWriters.end(); ++it){
if ((*it) == var){
Expand Down Expand Up @@ -891,7 +891,7 @@ bool MessageReceiver::proc_Submsg_Acknack(CDRMessage_t* msg,SubmessageHeader_t*
{
if((*it)->getGuid() == writerGUID)
{
if((*it)->getAttributes()->reliabilityKind == RELIABLE)
if((*it)->getAttributes().reliabilityKind == RELIABLE)
{
StatefulWriter* SF = (StatefulWriter*)(*it);
SF->process_acknack(readerGUID, Ackcount, SNSet, finalFlag);
Expand Down Expand Up @@ -1057,7 +1057,7 @@ bool MessageReceiver::proc_Submsg_NackFrag(CDRMessage_t*msg, SubmessageHeader_t*
std::lock_guard<std::recursive_mutex> guardW(*(*it)->getMutex());
if ((*it)->getGuid() == writerGUID)
{
if ((*it)->getAttributes()->reliabilityKind == RELIABLE)
if ((*it)->getAttributes().reliabilityKind == RELIABLE)
{
StatefulWriter* SF = (StatefulWriter*)(*it);

Expand Down
Loading