Skip to content

Commit

Permalink
Fix statistics header file inclusion [11614] (#1983)
Browse files Browse the repository at this point in the history
* Refs #11612. Fix header file inclusion

* Refs #11612. Add suggestion
  • Loading branch information
richiware authored May 24, 2021
1 parent d5f3559 commit 7e679b0
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 166 deletions.
4 changes: 0 additions & 4 deletions include/fastdds/rtps/reader/RTPSReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
#include <fastrtps/qos/LivelinessChangedStatus.h>
#include <fastrtps/utils/TimedConditionVariable.hpp>

#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#else
#include <fastdds/statistics/rtps/StatisticsCommonEmpty.hpp>
#endif // FASTDDS_STATISTICS

namespace eprosima {
namespace fastrtps {
Expand Down
4 changes: 0 additions & 4 deletions include/fastdds/rtps/writer/RTPSWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
#include <fastrtps/qos/LivelinessLostStatus.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>

#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#else
#include <fastdds/statistics/rtps/StatisticsCommonEmpty.hpp>
#endif // FASTDDS_STATISTICS

namespace eprosima {
namespace fastrtps {
Expand Down
119 changes: 119 additions & 0 deletions include/fastdds/statistics/rtps/StatisticsCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class RTPSMessageGroup;
namespace fastdds {
namespace statistics {

#ifdef FASTDDS_STATISTICS

// Members are private details
struct StatisticsAncillary;

Expand Down Expand Up @@ -256,6 +258,123 @@ class StatisticsReaderImpl
uint32_t payload);
};

#else // when FASTDDS_STATISTICS is not defined a dummy implementation is used

class StatisticsWriterImpl
{
protected:

// TODO: methods for listeners callbacks

/**
* @brief Report a change on the number of DATA / DATAFRAG submessages sent for a specific sample.
* @param SampleIdentity of the affected sample.
* @param Current total number of submessages sent for the affected sample.
*/
inline void on_sample_datas(
const fastrtps::rtps::SampleIdentity&,
size_t)
{
}

/**
* @brief Report that a HEARTBEAT message is sent
* @param current count of heartbeats
*/
inline void on_heartbeat(
uint32_t)
{
}

/**
* @brief Report that a DATA / DATA_FRAG message is generated
* @param number of locators to which the message will be sent
*/
inline void on_data_generated(
size_t)
{
}

/// Notify listeners of DATA / DATA_FRAG counts
inline void on_data_sent()
{
}

/**
* @brief Reports publication throughtput based on last added sample to writer's history
* @param size of the message sent
*/
inline void on_publish_throughput(
uint32_t)
{
}

/// Report that a GAP message is sent
inline void on_gap()
{
}

/*
* @brief Report that several changes are marked for redelivery
* @param number of changes to redeliver
*/
inline void on_resent_data(
uint32_t)
{
}

};

class StatisticsReaderImpl
{
friend class fastrtps::rtps::RTPSMessageGroup;

protected:

// TODO: methods for listeners callbacks

/**
* @brief Report that a sample has been notified to the user.
* @param GUID of the writer from where the sample was received.
* @param Source timestamp received from the writer for the sample being notified.
*/
inline void on_data_notify(
const fastrtps::rtps::GUID_t&,
const fastrtps::rtps::Time_t&)
{
}

/**
* @brief Report that an ACKNACK message is sent
* @param current count of ACKNACKs
*/
inline void on_acknack(
int32_t)
{
}

/**
* @brief Report that a NACKFRAG message is sent
* @param current count of NACKFRAGs
*/
inline void on_nackfrag(
int32_t)
{
}

/**
* @brief Reports subscription throughtput based on last added sample to reader's history
* @param size of the message received
*/
inline void on_subscribe_throughput(
uint32_t)
{
}

};

#endif // FASTDDS_STATISTICS

} // namespace statistics
} // namespace fastdds
} // namespace eprosima
Expand Down
158 changes: 0 additions & 158 deletions include/fastdds/statistics/rtps/StatisticsCommonEmpty.hpp

This file was deleted.

0 comments on commit 7e679b0

Please sign in to comment.