Skip to content

Commit

Permalink
Refs #20739: Refactor include and src files
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Apr 4, 2024
1 parent d493ab0 commit 33ce4ba
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 110 deletions.
9 changes: 8 additions & 1 deletion include/fastdds/rtps/builtin/discovery/participant/PDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <fastdds/rtps/participant/ParticipantDiscoveryInfo.h>
#include <fastdds/rtps/reader/ReaderDiscoveryInfo.h>
#include <fastdds/rtps/writer/WriterDiscoveryInfo.h>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IProxyObserver.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IProxyQueryable.hpp>
#include <fastrtps/qos/QosPolicies.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>
Expand All @@ -42,6 +41,14 @@
namespace eprosima {

namespace fastdds {
namespace statistics {
namespace rtps {

struct IProxyObserver;

} // namespace rtps
} // namespace statistics

namespace rtps {

class PDPServerListener;
Expand Down
5 changes: 1 addition & 4 deletions include/fastdds/rtps/reader/RTPSReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/history/ReaderHistory.h>
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsQueryable.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsObserver.hpp>
#endif // ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/connections_fwd.hpp>
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#include <fastrtps/qos/LivelinessChangedStatus.h>
#include <fastrtps/utils/TimedConditionVariable.hpp>
Expand Down
5 changes: 1 addition & 4 deletions include/fastdds/rtps/writer/RTPSWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
#include <fastdds/rtps/messages/RTPSMessageGroup.h>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsObserver.hpp>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsQueryable.hpp>
#endif // ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/connections_fwd.hpp>
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#include <fastrtps/qos/LivelinessLostStatus.h>

Expand Down
31 changes: 24 additions & 7 deletions src/cpp/fastdds/publisher/PublisherImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,7 @@ PublisherListener* PublisherImpl::get_listener_for(

#ifdef FASTDDS_STATISTICS
bool PublisherImpl::get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid)
{
bool ret = false;
Expand All @@ -682,11 +681,21 @@ bool PublisherImpl::get_monitoring_status(
{
if (writer->guid() == entity_guid)
{
switch (status_id)
switch (status._d())
{
case statistics::INCOMPATIBLE_QOS:
{
writer->get_offered_incompatible_qos_status(*static_cast<OfferedIncompatibleQosStatus*>(status));
OfferedIncompatibleQosStatus incompatible_qos_status;
writer->get_offered_incompatible_qos_status(incompatible_qos_status);
status.incompatible_qos_status().total_count(incompatible_qos_status.total_count);
status.incompatible_qos_status().last_policy_id(incompatible_qos_status.last_policy_id);
for (auto& qos : incompatible_qos_status.policies)
{
statistics::QosPolicyCount_s count;
count.count(qos.count);
count.policy_id(qos.policy_id);
status.incompatible_qos_status().policies().push_back(count);
}
ret = true;
break;
}
Expand All @@ -699,19 +708,27 @@ bool PublisherImpl::get_monitoring_status(
}*/
case statistics::LIVELINESS_LOST:
{
writer->get_liveliness_lost_status(*static_cast<LivelinessLostStatus*>(status));
LivelinessLostStatus liveliness_lost_status;
writer->get_liveliness_lost_status(liveliness_lost_status);
status.liveliness_lost_status().total_count(liveliness_lost_status.total_count);
ret = true;
break;
}
case statistics::DEADLINE_MISSED:
{
writer->get_offered_deadline_missed_status(*static_cast<DeadlineMissedStatus*>(status));
DeadlineMissedStatus deadline_missed_status;
writer->get_offered_deadline_missed_status(deadline_missed_status);
status.deadline_missed_status().total_count(deadline_missed_status.total_count);
std::memcpy(
status.deadline_missed_status().last_instance_handle().data(),
deadline_missed_status.last_instance_handle.value,
16);
ret = true;
break;
}
default:
{
EPROSIMA_LOG_ERROR(PUBLISHER, "Queried status not available for this entity " << status_id);
EPROSIMA_LOG_ERROR(PUBLISHER, "Queried status not available for this entity " << status._d());
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/fastdds/publisher/PublisherImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <map>

#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IStatusQueryable.hpp>
#include <statistics/rtps/monitor-service/interfaces/IStatusQueryable.hpp>
#endif // ifdef FASTDDS_STATISTICS

using eprosima::fastrtps::types::ReturnCode_t;
Expand Down Expand Up @@ -206,8 +206,7 @@ class PublisherImpl

#ifdef FASTDDS_STATISTICS
bool get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid);
#endif //FASTDDS_STATISTICS

Expand Down
41 changes: 32 additions & 9 deletions src/cpp/fastdds/subscriber/SubscriberImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,7 @@ bool SubscriberImpl::can_be_deleted() const

#ifdef FASTDDS_STATISTICS
bool SubscriberImpl::get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid)
{
bool ret = false;
Expand All @@ -699,12 +698,21 @@ bool SubscriberImpl::get_monitoring_status(
{
if (reader->guid() == entity_guid)
{
switch (status_id)
switch (status._d())
{
case statistics::INCOMPATIBLE_QOS:
{
reader->get_requested_incompatible_qos_status(*static_cast<RequestedIncompatibleQosStatus*>(
status));
RequestedIncompatibleQosStatus incompatible_qos_status;
reader->get_requested_incompatible_qos_status(incompatible_qos_status);
status.incompatible_qos_status().total_count(incompatible_qos_status.total_count);
status.incompatible_qos_status().last_policy_id(incompatible_qos_status.last_policy_id);
for (auto& qos : incompatible_qos_status.policies)
{
statistics::QosPolicyCount_s count;
count.count(qos.count);
count.policy_id(qos.policy_id);
status.incompatible_qos_status().policies().push_back(count);
}
ret = true;
break;
}
Expand All @@ -717,25 +725,40 @@ bool SubscriberImpl::get_monitoring_status(
}*/
case statistics::LIVELINESS_CHANGED:
{
reader->get_liveliness_changed_status(*static_cast<LivelinessChangedStatus*>(status));
LivelinessChangedStatus liveliness_changed_status;
reader->get_liveliness_changed_status(liveliness_changed_status);
status.liveliness_changed_status().alive_count(liveliness_changed_status.alive_count);
status.liveliness_changed_status().not_alive_count(liveliness_changed_status.not_alive_count);
std::memcpy(
status.liveliness_changed_status().last_publication_handle().data(),
liveliness_changed_status.last_publication_handle.value,
16);
ret = true;
break;
}
case statistics::DEADLINE_MISSED:
{
reader->get_requested_deadline_missed_status(*static_cast<DeadlineMissedStatus*>(status));
DeadlineMissedStatus deadline_missed_status;
reader->get_requested_deadline_missed_status(deadline_missed_status);
status.deadline_missed_status().total_count(deadline_missed_status.total_count);
std::memcpy(
status.deadline_missed_status().last_instance_handle().data(),
deadline_missed_status.last_instance_handle.value,
16);
ret = true;
break;
}
case statistics::SAMPLE_LOST:
{
reader->get_sample_lost_status(*static_cast<SampleLostStatus*>(status));
SampleLostStatus sample_lost_status;
reader->get_sample_lost_status(sample_lost_status);
status.sample_lost_status().total_count(sample_lost_status.total_count);
ret = true;
break;
}
default:
{
EPROSIMA_LOG_ERROR(SUBSCRIBER, "Queried status not available for this entity " << status_id);
EPROSIMA_LOG_ERROR(SUBSCRIBER, "Queried status not available for this entity " << status._d());
break;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/fastdds/subscriber/SubscriberImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <fastdds/dds/core/status/StatusMask.hpp>
#include <fastrtps/types/TypesBase.h>

#include <fastdds/statistics/rtps/monitor_service/interfaces/IStatusQueryable.hpp>
#include <statistics/rtps/monitor-service/interfaces/IStatusQueryable.hpp>

#include <mutex>
#include <map>
Expand Down Expand Up @@ -231,8 +231,7 @@ class SubscriberImpl

#ifdef FASTDDS_STATISTICS
bool get_monitoring_status(
const uint32_t& status_id,
statistics::rtps::DDSEntityStatus*& status,
statistics::MonitorServiceData& status,
const fastrtps::rtps::GUID_t& entity_guid);
#endif //FASTDDS_STATISTICS

Expand Down
3 changes: 3 additions & 0 deletions src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#include <rtps/builtin/data/ProxyHashTables.hpp>
#include <rtps/network/utils/external_locators.hpp>
#include <rtps/participant/RTPSParticipantImpl.h>
#ifdef FASTDDS_STATISTICS
#include <statistics/rtps/monitor-service/interfaces/IProxyObserver.hpp>
#endif //FASTDDS_STATISTICS

#include <utils/collections/node_size_helpers.hpp>

Expand Down
3 changes: 3 additions & 0 deletions src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include <fastdds/dds/log/Log.hpp>

#include <rtps/history/TopicPayloadPoolRegistry.hpp>
#ifdef FASTDDS_STATISTICS
#include <statistics/rtps/monitor-service/interfaces/IProxyObserver.hpp>
#endif //FASTDDS_STATISTICS

#include <rtps/builtin/discovery/endpoint/EDPUtils.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <mutex>

#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsObserver.hpp>
#include <statistics/rtps/monitor-service/interfaces/IConnectionsObserver.hpp>
#endif //FASTDDS_STATISTICS

using ParameterList = eprosima::fastdds::dds::ParameterList;
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/rtps/participant/RTPSParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <fastdds/rtps/messages/MessageReceiver.h>
#include <fastdds/rtps/resources/ResourceEvent.h>
#include <fastdds/rtps/transport/SenderResource.h>
#include <fastdds/statistics/rtps/monitor_service/interfaces/IConnectionsQueryable.hpp>
#include <fastrtps/utils/Semaphore.h>
#include <fastrtps/utils/shared_mutex.hpp>

Expand All @@ -55,6 +54,8 @@
#include <rtps/messages/SendBuffersManager.hpp>
#include <rtps/network/NetworkFactory.h>
#include <rtps/network/ReceiverResource.h>
#include <statistics/rtps/monitor-service/interfaces/IConnectionsObserver.hpp>
#include <statistics/rtps/monitor-service/interfaces/IConnectionsQueryable.hpp>
#include <statistics/rtps/StatisticsBase.hpp>
#include <statistics/types/monitorservice_types.h>

Expand Down
7 changes: 3 additions & 4 deletions src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,7 @@ bool DomainParticipantImpl::delete_topic_and_type(

bool DomainParticipantImpl::get_monitoring_status(
const fastrtps::rtps::GUID_t& entity_guid,
const uint32_t& status_id,
eprosima::fastdds::statistics::rtps::DDSEntityStatus*& status)
eprosima::fastdds::statistics::MonitorServiceData& status)
{
ReturnCode_t ret = ReturnCode_t::RETCODE_ERROR;

Expand All @@ -634,7 +633,7 @@ bool DomainParticipantImpl::get_monitoring_status(
std::lock_guard<std::mutex> lock(mtx_subs_);
for (auto& sub : subscribers_)
{
if (sub.second->get_monitoring_status(status_id, status, entity_guid))
if (sub.second->get_monitoring_status(status, entity_guid))
{
ret = ReturnCode_t::RETCODE_OK;
break;
Expand All @@ -646,7 +645,7 @@ bool DomainParticipantImpl::get_monitoring_status(
std::lock_guard<std::mutex> lock(mtx_pubs_);
for (auto& pub : publishers_)
{
if (pub.second->get_monitoring_status(status_id, status, entity_guid))
if (pub.second->get_monitoring_status(status, entity_guid))
{
ret = ReturnCode_t::RETCODE_OK;
break;
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/statistics/fastdds/domain/DomainParticipantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
#include <fastdds/dds/topic/Topic.hpp>
#include <fastdds/dds/topic/TopicDescription.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>
#include <fastdds/statistics/rtps/monitor_service/Interfaces.hpp>
#include <fastrtps/types/TypesBase.h>

#include <fastdds/domain/DomainParticipantImpl.hpp>

#include "DomainParticipantStatisticsListener.hpp"
#include <statistics/rtps/monitor-service/Interfaces.hpp>

namespace efd = eprosima::fastdds::dds;

Expand Down Expand Up @@ -290,8 +290,7 @@ class DomainParticipantImpl : public efd::DomainParticipantImpl,
*/
bool get_monitoring_status(
const fastrtps::rtps::GUID_t& entity_guid,
const uint32_t& status_id,
eprosima::fastdds::statistics::rtps::DDSEntityStatus*&) override;
eprosima::fastdds::statistics::MonitorServiceData&) override;

efd::Publisher* builtin_publisher_ = nullptr;
PublisherImpl* builtin_publisher_impl_ = nullptr;
Expand Down
Loading

0 comments on commit 33ce4ba

Please sign in to comment.