Skip to content

Commit 4b61250

Browse files
authored
Fix small details (#14)
* Add last implementation details Signed-off-by: jparisu <[email protected]> * Add details Signed-off-by: jparisu <[email protected]> * uncrustify Signed-off-by: jparisu <[email protected]> --------- Signed-off-by: jparisu <[email protected]>
1 parent ce8cdf1 commit 4b61250

File tree

23 files changed

+128
-68
lines changed

23 files changed

+128
-68
lines changed

.github/workflows/test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ on:
6767
- cron: '0 5 * * *'
6868

6969
env:
70-
# TODO: add more packages
7170
code_packages_names: 'fastddsspy_participants fastddsspy_yaml fastddsspy_tool'
7271
default_dependencies_artifact_postfix: '_nightly'
7372

docs/rst/developer_manual/installation/sources/linux.rst

-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ Colcon installation
193193
Being based on CMake_, it is possible to pass the CMake configuration options to the :code:`colcon build` command.
194194
For more information on the specific syntax, please refer to the `CMake specific arguments <https://colcon.readthedocs.io/en/released/reference/verb/build.html#cmake-specific-arguments>`_ page of the colcon_ manual.
195195

196-
.. TODO check if this is correctly parsed, because in local it does not render correctly
197196

198197
CMake installation
199198
==================

docs/rst/developer_manual/installation/sources/windows.rst

-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ Colcon installation (recommended)
229229
For more information on the specific syntax, please refer to the `CMake specific arguments <https://colcon.readthedocs.io/en/released/reference/verb/build.html#cmake-specific-arguments>`_ page of the colcon_ manual.
230230

231231

232-
.. TODO check if this is correctly parsed, because in local it does not render correctly
233-
234232
CMake installation
235233
==================
236234

fastddsspy_participants/include/fastddsspy_participants/configuration/SpyParticipantConfiguration.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace spy {
2222
namespace participants {
2323

2424
/**
25-
* TODO
25+
* TODO comment
2626
*/
2727
struct SpyParticipantConfiguration : ddspipe::participants::ParticipantConfiguration
2828
{

fastddsspy_participants/include/fastddsspy_participants/model/DataStreamer.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace spy {
3030
namespace participants {
3131

3232
/**
33-
* TODO
33+
* TODO comment
3434
*/
3535
class DataStreamer : public TopicRateCalculator
3636
{

fastddsspy_participants/include/fastddsspy_participants/model/NetworkDatabase.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace spy {
2727
namespace participants {
2828

2929
/**
30-
* TODO
30+
* TODO comment
3131
*/
3232
struct NetworkDatabase
3333
{

fastddsspy_participants/include/fastddsspy_participants/model/SpyModel.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace spy {
2222
namespace participants {
2323

2424
/**
25-
* TODO
25+
* TODO comment
2626
*/
2727
class SpyModel : public NetworkDatabase, public DataStreamer
2828
{

fastddsspy_participants/include/fastddsspy_participants/model/TopicRateCalculator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace spy {
2828
namespace participants {
2929

3030
/**
31-
* TODO
31+
* TODO comment
3232
*/
3333
class TopicRateCalculator : public ddspipe::participants::ISchemaHandler
3434
{

fastddsspy_participants/include/fastddsspy_participants/participant/SpyDdsParticipant.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace spy {
2525
namespace participants {
2626

2727
/**
28-
* TODO
28+
* TODO comment
2929
*/
3030
class SpyDdsParticipant : public ddspipe::participants::DynTypesParticipant
3131
{

fastddsspy_participants/include/fastddsspy_participants/participant/SpyParticipant.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ namespace spy {
2727
namespace participants {
2828

2929
/**
30-
* TODO
30+
* TODO comment
3131
*/
3232
class SpyParticipant : public ddspipe::participants::SchemaParticipant
3333
{
3434
public:
3535

36-
// TODO
36+
// TODO comment
3737
SpyParticipant(
3838
const std::shared_ptr<ddspipe::participants::ParticipantConfiguration>& participant_configuration,
3939
const std::shared_ptr<ddspipe::core::PayloadPool>& payload_pool,

fastddsspy_participants/include/fastddsspy_participants/types/EndpointInfo.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace participants {
2828
using EndpointInfo = ddspipe::core::types::Endpoint;
2929

3030
/**
31-
* TODO
31+
* TODO comment
3232
*/
3333
struct EndpointInfoData : public ddspipe::core::IRoutingData
3434
{

fastddsspy_participants/include/fastddsspy_participants/types/ParticipantInfo.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace spy {
2525
namespace participants {
2626

2727
/**
28-
* TODO
28+
* TODO comment
2929
*/
3030
struct ParticipantInfo
3131
{
@@ -40,7 +40,7 @@ struct ParticipantInfo
4040
};
4141

4242
/**
43-
* TODO
43+
* TODO comment
4444
*/
4545
struct ParticipantInfoData : public ddspipe::core::IRoutingData
4646
{

fastddsspy_participants/src/cpp/model/DataStreamer.cpp

+32-12
Original file line numberDiff line numberDiff line change
@@ -87,30 +87,50 @@ void DataStreamer::add_data(
8787
{
8888
TopicRateCalculator::add_data(topic, data);
8989

90-
std::shared_lock<std::shared_timed_mutex> _(mutex_);
90+
fastrtps::types::DynamicType_ptr dyn_type;
9191

92-
if (activated_)
9392
{
94-
// If all activated, add it only if schema is available, otherwise skip
95-
if (activated_all_ && !is_topic_type_discovered_nts_(topic))
93+
std::shared_lock<std::shared_timed_mutex> _(mutex_);
94+
95+
if (!activated_)
9696
{
97+
// If not activated, do nothing.
9798
return;
9899
}
99100

100-
if (activated_all_ || activated_topic_ == topic)
101+
if (activated_all_)
102+
{
103+
if (!is_topic_type_discovered_nts_(topic))
104+
{
105+
// If all activated, add it only if schema is available, otherwise skip
106+
return;
107+
}
108+
}
109+
else
101110
{
102-
auto it = types_discovered_.find(topic.type_name);
103-
if (it == types_discovered_.end())
111+
if (!(activated_topic_ == topic))
104112
{
105-
// The topic that is supposed to be activated has no associated type. This should not happen
106-
utils::tsnh(STR_ENTRY
107-
<< "Topic <" << topic << "> must not be activated if its type is not registered.");
113+
// If not all activated, and this is not the activated topic skip
114+
return;
108115
}
116+
}
109117

110-
// TODO: make map search more safe
111-
(*callback_)(topic, it->second, data);
118+
auto it = types_discovered_.find(topic.type_name);
119+
if (it == types_discovered_.end())
120+
{
121+
// The topic that is supposed to be activated has no associated type. This should not happen
122+
utils::tsnh(STR_ENTRY
123+
<< "Topic <" << topic << "> must not be activated if its type is not registered.");
124+
}
125+
else
126+
{
127+
dyn_type = it->second;
112128
}
113129
}
130+
131+
// This should be called without mutex taken
132+
// Here should only arrive if it must call callback. Otherwise must return somewhere before
133+
(*callback_)(topic, dyn_type, data);
114134
}
115135

116136
bool DataStreamer::is_topic_type_discovered(

fastddsspy_participants/src/cpp/model/TopicRateCalculator.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License\.
1414

15+
#include <limits>
16+
1517
#include <fastddsspy_participants/model/TopicRateCalculator.hpp>
1618

1719
namespace eprosima {
@@ -54,8 +56,8 @@ TopicRateCalculator::RateType TopicRateCalculator::get_topic_rate(
5456
float seconds_elapsed = data.last_data_time.seconds() - data.first_data_time.seconds();
5557
if (seconds_elapsed == 0)
5658
{
57-
// TODO decide what to do in this case
58-
return data.data_received;
59+
// If not enough data to set the rate, return invalid value
60+
return std::numeric_limits<float>::infinity();
5961
}
6062

6163
return static_cast<float>(data.data_received) / seconds_elapsed;

fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ void SpyDdsParticipant::on_subscriber_discovery(
8484
}
8585

8686
EndpointInfo endpoint_info = create_endpoint_from_info_(info);
87-
// TODO: check if this notification arrives when a participants leaves
87+
88+
// If participant left or dropped, this notification arrives as well
8889
endpoint_info.active = !(info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::REMOVED_READER);
8990

9091
internal_notify_endpoint_discovered_(endpoint_info);
@@ -101,7 +102,8 @@ void SpyDdsParticipant::on_publisher_discovery(
101102
}
102103

103104
EndpointInfo endpoint_info = create_endpoint_from_info_(info);
104-
// TODO: check if this notification arrives when a participants leaves
105+
106+
// If participant left or dropped, this notification arrives as well
105107
endpoint_info.active = !(info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::REMOVED_WRITER);
106108

107109
internal_notify_endpoint_discovered_(endpoint_info);

fastddsspy_participants/src/cpp/visualization/ModelParser.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ std::vector<ComplexEndpointData> ModelParser::writers_verbose(
218218

219219
for (const auto& endpoint : model.endpoint_database_)
220220
{
221-
if (endpoint.second.is_writer())
221+
if (endpoint.second.active && endpoint.second.is_writer())
222222
{
223223
result.push_back(writers(model, endpoint.second.guid));
224224
}
@@ -255,7 +255,7 @@ std::vector<ComplexEndpointData> ModelParser::readers_verbose(
255255

256256
for (const auto& endpoint : model.endpoint_database_)
257257
{
258-
if (endpoint.second.is_reader())
258+
if (endpoint.second.active && endpoint.second.is_reader())
259259
{
260260
result.push_back(readers(model, endpoint.second.guid));
261261
}
@@ -284,7 +284,10 @@ std::set<eprosima::ddspipe::core::types::DdsTopic> get_topics(
284284
std::set<eprosima::ddspipe::core::types::DdsTopic> result;
285285
for (const auto& endpoint : model.endpoint_database_)
286286
{
287-
result.insert(endpoint.second.topic);
287+
if (endpoint.second.active)
288+
{
289+
result.insert(endpoint.second.topic);
290+
}
288291
}
289292
return result;
290293
}
@@ -296,7 +299,7 @@ ddspipe::core::types::DdsTopic ModelParser::get_topic(
296299

297300
for (const auto& endpoint : model.endpoint_database_)
298301
{
299-
if (endpoint.second.topic.m_topic_name == topic_name)
302+
if (endpoint.second.active && endpoint.second.topic.m_topic_name == topic_name)
300303
{
301304
return endpoint.second.topic;
302305
}
@@ -317,7 +320,7 @@ std::vector<SimpleTopicData> ModelParser::topics(
317320
int datareaders = 0;
318321
for (const auto& endpoint : model.endpoint_database_)
319322
{
320-
if (endpoint.second.topic.m_topic_name == topic.m_topic_name)
323+
if (endpoint.second.active && endpoint.second.topic.m_topic_name == topic.m_topic_name)
321324
{
322325
if (endpoint.second.is_reader())
323326
{
@@ -383,7 +386,7 @@ ComplexTopicData ModelParser::topics(
383386

384387
for (const auto& it : model.endpoint_database_)
385388
{
386-
if (topic.m_topic_name == it.second.topic.m_topic_name)
389+
if (it.second.active && topic.m_topic_name == it.second.topic.m_topic_name)
387390
{
388391
if (it.second.is_reader())
389392
{

fastddsspy_tool/src/cpp/tool/Backend.hpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,34 @@ class Backend
5353

5454
protected:
5555

56-
// TODO
56+
// TODO comment
5757
yaml::Configuration configuration_;
5858

59-
//! TODO
59+
//! TODO comment
6060
std::shared_ptr<ddspipe::core::PayloadPool> payload_pool_;
6161

62-
//! TODO
62+
//! TODO comment
6363
std::shared_ptr<ddspipe::core::DiscoveryDatabase> discovery_database_;
6464

65-
//! TODO
65+
//! TODO comment
6666
std::shared_ptr<ddspipe::core::AllowedTopicList> allowed_topics_;
6767

68-
//! TODO
68+
//! TODO comment
6969
std::shared_ptr<eprosima::utils::SlotThreadPool> thread_pool_;
7070

71-
//! TODO
71+
//! TODO comment
7272
std::shared_ptr<ddspipe::core::ParticipantsDatabase> participant_database_;
7373

74-
//! TODO
74+
//! TODO comment
7575
std::shared_ptr<eprosima::spy::participants::SpyModel> model_;
7676

77-
//! TODO
77+
//! TODO comment
7878
std::shared_ptr<eprosima::spy::participants::SpyDdsParticipant> dds_participant_;
7979

80-
//! TODO
80+
//! TODO comment
8181
std::shared_ptr<eprosima::spy::participants::SpyParticipant> spy_participant_;
8282

83-
//! TODO
83+
//! TODO comment
8484
std::unique_ptr<ddspipe::core::DdsPipe> pipe_;
8585

8686
};

fastddsspy_tool/src/cpp/tool/Command.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ eProsima_ENUMERATION_BUILDER(
3939
CommandValue,
4040
{
4141
{ CommandValue::empty_command COMMA {""}} COMMA
42-
{ CommandValue::help COMMA {"h" COMMA "help" COMMA "H" COMMA "man"}} COMMA
43-
{ CommandValue::exit COMMA {"q" COMMA "x" COMMA "quit" COMMA "quit()" COMMA "exit" COMMA "exit()"}} COMMA
42+
{ CommandValue::help COMMA {"help" COMMA "h" COMMA "H" COMMA "man"}} COMMA
43+
{ CommandValue::exit COMMA {"quit" COMMA "q" COMMA "Q" COMMA "quit()" COMMA "exit" COMMA "x" COMMA "exit()"}} COMMA
4444
{ CommandValue::version COMMA {"version" COMMA "v" COMMA "V"}} COMMA
4545
{ CommandValue::participant COMMA {"participant" COMMA "participants" COMMA "p" COMMA "P"}} COMMA
46-
{ CommandValue::datawriter COMMA {"datawriter" COMMA "datawriters" COMMA "writer" COMMA "writers" COMMA "publication" COMMA "publications" COMMA "w" COMMA "W"}} COMMA
47-
{ CommandValue::datareader COMMA {"datareader" COMMA "datareaders" COMMA "reader" COMMA "readers" COMMA "subscription" COMMA "subscriptions" COMMA "r" COMMA "R"}} COMMA
46+
{ CommandValue::datawriter COMMA {"datawriter" COMMA "datawriters" COMMA "w" COMMA "W" COMMA "writer" COMMA "writers" COMMA "publication" COMMA "publications"}} COMMA
47+
{ CommandValue::datareader COMMA {"datareader" COMMA "datareaders" COMMA "r" COMMA "R" COMMA "reader" COMMA "readers" COMMA "subscription" COMMA "subscriptions"}} COMMA
4848
{ CommandValue::topic COMMA {"topic" COMMA "topics" COMMA "t" COMMA "T"}} COMMA
49-
{ CommandValue::print COMMA {"print" COMMA "show"}} COMMA
49+
{ CommandValue::print COMMA {"print" COMMA "show" COMMA "s" COMMA "S"}} COMMA
5050
}
5151
);
5252

0 commit comments

Comments
 (0)