@@ -508,6 +508,15 @@ std::vector<EntityId> StatisticsBackend::get_entities(
508
508
return StatisticsBackendData::get_instance ()->database_ ->get_entity_ids (entity_type, entity_id);
509
509
}
510
510
511
+ EntityId StatisticsBackend::get_entity_by_guid (
512
+ const std::string& guid)
513
+ {
514
+ return StatisticsBackendData::get_instance ()->database_ ->get_entity_by_guid (
515
+ StatisticsBackendData::get_instance ()->database_ ->get_entity_kind_by_guid (
516
+ StatisticsBackend::serialize_guid (guid)),
517
+ guid).second ;
518
+ }
519
+
511
520
bool StatisticsBackend::is_active (
512
521
EntityId entity_id)
513
522
{
@@ -994,5 +1003,37 @@ std::string StatisticsBackend::deserialize_guid(
994
1003
return ss.str ();
995
1004
}
996
1005
1006
+ fastdds::statistics::detail::GUID_s StatisticsBackend::serialize_guid (
1007
+ const std::string& guid_str)
1008
+ {
1009
+ fastdds::statistics::detail::GUID_s guid_s;
1010
+ std::istringstream iss (guid_str);
1011
+ std::string byte_str;
1012
+
1013
+ // Parse the guidPrefix part
1014
+ uint8_t guid_prefix_size = static_cast <uint8_t >(fastdds::rtps::GuidPrefix_t::size);
1015
+ for (uint8_t i = 0 ; i < guid_prefix_size; ++i)
1016
+ {
1017
+ if (i == (guid_prefix_size - 1 ))
1018
+ {
1019
+ std::getline (iss, byte_str, ' |' );
1020
+ }
1021
+ else
1022
+ {
1023
+ std::getline (iss, byte_str, ' .' );
1024
+ }
1025
+ guid_s.guidPrefix ().value ()[i] = static_cast <uint8_t >(std::stoul (byte_str, nullptr , 16 ));
1026
+ }
1027
+
1028
+ // Parse the entityId part
1029
+ for (uint8_t i = 0 ; i < static_cast <uint8_t >(fastdds::rtps::EntityId_t::size); ++i)
1030
+ {
1031
+ std::getline (iss, byte_str, ' .' );
1032
+ guid_s.entityId ().value ()[i] = static_cast <uint8_t >(std::stoul (byte_str, nullptr , 16 ));
1033
+ }
1034
+
1035
+ return guid_s;
1036
+ }
1037
+
997
1038
} // namespace statistics_backend
998
1039
} // namespace eprosima
0 commit comments