2525#include < fastdds_statistics_backend/types/types.hpp>
2626#include < fastdds_statistics_backend/types/EntityId.hpp>
2727
28+ #include < types/fragile_ptr.hpp>
29+
2830#include " data.hpp"
2931
3032namespace eprosima {
@@ -118,7 +120,7 @@ struct Host : Entity
118120 * Collection of users within the host which are involved in the communication.
119121 * The collection is ordered by the EntityId of the user nodes.
120122 */
121- std::map<EntityId, std::shared_ptr <User>> users;
123+ std::map<EntityId, details::fragile_ptr <User>> users;
122124};
123125
124126/*
@@ -128,7 +130,7 @@ struct User : Entity
128130{
129131 User (
130132 std::string user_name,
131- std::shared_ptr <Host> user_host) noexcept
133+ details::fragile_ptr <Host> user_host) noexcept
132134 : Entity(EntityKind::USER, user_name, false , false )
133135 , host(user_host)
134136 {
@@ -140,13 +142,13 @@ struct User : Entity
140142 void clear () final ;
141143
142144 // ! Reference to the Host in which this user runs
143- std::shared_ptr <Host> host;
145+ details::fragile_ptr <Host> host;
144146
145147 /*
146148 * Collection of processes within the host which are involved in the communication.
147149 * The collection is ordered by the EntityId of the process nodes.
148150 */
149- std::map<EntityId, std::shared_ptr <Process>> processes;
151+ std::map<EntityId, details::fragile_ptr <Process>> processes;
150152};
151153
152154/*
@@ -157,7 +159,7 @@ struct Process : Entity
157159 Process (
158160 std::string process_name,
159161 std::string process_id,
160- std::shared_ptr <User> process_user) noexcept
162+ details::fragile_ptr <User> process_user) noexcept
161163 : Entity(EntityKind::PROCESS, process_name, false , false )
162164 , pid(process_id)
163165 , user(process_user)
@@ -173,13 +175,13 @@ struct Process : Entity
173175 std::string pid;
174176
175177 // ! Reference to the User in which this process runs.
176- std::shared_ptr <User> user;
178+ details::fragile_ptr <User> user;
177179
178180 /*
179181 * Collection of DomainParticipant within the process which are involved in the communication.
180182 * The collection is ordered by the EntityId of the DomainParticipant nodes.
181183 */
182- std::map<EntityId, std::shared_ptr <DomainParticipant>> participants;
184+ std::map<EntityId, details::fragile_ptr <DomainParticipant>> participants;
183185};
184186
185187/*
@@ -203,13 +205,13 @@ struct Domain : Entity
203205 * Collection of Topics within the Domain which are either published, subscribed, or both.
204206 * The collection is ordered by the EntityId of the Topic nodes.
205207 */
206- std::map<EntityId, std::shared_ptr <Topic>> topics;
208+ std::map<EntityId, details::fragile_ptr <Topic>> topics;
207209
208210 /*
209211 * Collection of DomainParticipant within the Domain which are involved in the communication.
210212 * The collection is ordered by the EntityId of the DomainParticipant nodes.
211213 */
212- std::map<EntityId, std::shared_ptr <DomainParticipant>> participants;
214+ std::map<EntityId, details::fragile_ptr <DomainParticipant>> participants;
213215};
214216
215217/*
@@ -245,14 +247,14 @@ struct DDSEndpoint : DDSEntity
245247 std::string endpoint_name = " INVALID" ,
246248 Qos endpoint_qos = {},
247249 std::string endpoint_guid = " |GUID UNKNOWN|" ,
248- std::shared_ptr <DomainParticipant> endpoint_participant = nullptr ,
249- std::shared_ptr <Topic> endpoint_topic = nullptr ) noexcept ;
250+ details::fragile_ptr <DomainParticipant> endpoint_participant = nullptr ,
251+ details::fragile_ptr <Topic> endpoint_topic = nullptr ) noexcept ;
250252
251253 // ! Reference to the DomainParticipant in which this Endpoint runs.
252- std::shared_ptr <DomainParticipant> participant;
254+ details::fragile_ptr <DomainParticipant> participant;
253255
254256 // ! Reference to the Domain in which this endpoint publishes/subscribes.
255- std::shared_ptr <Topic> topic;
257+ details::fragile_ptr <Topic> topic;
256258
257259 // ! Flag to signal that this is a virtual endpoint used to collect meta traffic data.
258260 bool is_virtual_metatraffic = false ;
@@ -261,7 +263,7 @@ struct DDSEndpoint : DDSEntity
261263 * Collection of Locators related to this endpoint.
262264 * The collection is ordered by the EntityId of the Locator nodes.
263265 */
264- std::map<EntityId, std::shared_ptr <Locator>> locators;
266+ std::map<EntityId, details::fragile_ptr <Locator>> locators;
265267};
266268
267269/*
@@ -273,8 +275,8 @@ struct DomainParticipant : DDSEntity
273275 std::string participant_name,
274276 Qos participant_qos,
275277 std::string participant_guid,
276- std::shared_ptr <Process> participant_process,
277- std::shared_ptr <Domain> participant_domain) noexcept
278+ details::fragile_ptr <Process> participant_process,
279+ details::fragile_ptr <Domain> participant_domain) noexcept
278280 : DDSEntity(EntityKind::PARTICIPANT, participant_name, participant_qos, participant_guid)
279281 , process(participant_process)
280282 , domain(participant_domain)
@@ -287,28 +289,28 @@ struct DomainParticipant : DDSEntity
287289 void clear () final ;
288290
289291 template <typename T>
290- std::map<EntityId, std::shared_ptr <T>>& ddsendpoints ();
292+ std::map<EntityId, details::fragile_ptr <T>>& ddsendpoints ();
291293
292294 // ! Reference to the Process in which this DomainParticipant runs.
293- std::shared_ptr <Process> process;
295+ details::fragile_ptr <Process> process;
294296
295297 // ! Reference to the Domain in which this DomainParticipant runs.
296- std::shared_ptr <Domain> domain;
298+ details::fragile_ptr <Domain> domain;
297299
298300 // ! Reference to the meta traffic endpoint of this DomainParticipant.
299- std::shared_ptr <DDSEndpoint> meta_traffic_endpoint;
301+ details::fragile_ptr <DDSEndpoint> meta_traffic_endpoint;
300302
301303 /*
302304 * Collection of DataReaders within the DomainParticipant which are involved in the communication.
303305 * The collection is ordered by the EntityId of the DataReader nodes.
304306 */
305- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
307+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
306308
307309 /*
308310 * Collection of DataWriters within the DomainParticipant which are involved in the communication.
309311 * The collection is ordered by the EntityId of the DataWriter nodes.
310312 */
311- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
313+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
312314
313315 // ! Actual statistical data reported by Fast DDS Statistics Module regarding this DomainParticipant.
314316 DomainParticipantData data;
@@ -323,7 +325,7 @@ struct Topic : Entity
323325 Topic (
324326 std::string topic_name,
325327 std::string topic_type,
326- std::shared_ptr <Domain> topic_domain) noexcept
328+ details::fragile_ptr <Domain> topic_domain) noexcept
327329 : Entity(EntityKind::TOPIC, topic_name, is_metatraffic_topic(topic_name))
328330 , data_type(topic_type)
329331 , domain(topic_domain)
@@ -336,25 +338,25 @@ struct Topic : Entity
336338 void clear () final ;
337339
338340 template <typename T>
339- std::map<EntityId, std::shared_ptr <T>>& ddsendpoints ();
341+ std::map<EntityId, details::fragile_ptr <T>>& ddsendpoints ();
340342
341343 // ! The data type name of the topic
342344 std::string data_type;
343345
344346 // ! Reference to the Domain in which this topic is published/subscribed.
345- std::shared_ptr <Domain> domain;
347+ details::fragile_ptr <Domain> domain;
346348
347349 /*
348350 * Collection of Datareaders subscribing to this topic.
349351 * The collection is ordered by the EntityId of the Datareader nodes.
350352 */
351- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
353+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
352354
353355 /*
354356 * Collection of DataWriters publishind in this topic.
355357 * The collection is ordered by the EntityId of the DataWriter nodes.
356358 */
357- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
359+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
358360};
359361
360362/*
@@ -366,8 +368,8 @@ struct DataReader : DDSEndpoint
366368 std::string datareader_name,
367369 Qos datareader_qos,
368370 std::string datareader_guid,
369- std::shared_ptr <DomainParticipant> datareader_participant,
370- std::shared_ptr <Topic> datareader_topic) noexcept
371+ details::fragile_ptr <DomainParticipant> datareader_participant,
372+ details::fragile_ptr <Topic> datareader_topic) noexcept
371373 : DDSEndpoint(EntityKind::DATAREADER, datareader_name, datareader_qos, datareader_guid, datareader_participant,
372374 datareader_topic)
373375 {
@@ -392,8 +394,8 @@ struct DataWriter : DDSEndpoint
392394 std::string datawriter_name,
393395 Qos datawriter_qos,
394396 std::string datawriter_guid,
395- std::shared_ptr <DomainParticipant> datawriter_participant,
396- std::shared_ptr <Topic> datawriter_topic) noexcept
397+ details::fragile_ptr <DomainParticipant> datawriter_participant,
398+ details::fragile_ptr <Topic> datawriter_topic) noexcept
397399 : DDSEndpoint(EntityKind::DATAWRITER, datawriter_name, datawriter_qos, datawriter_guid, datawriter_participant,
398400 datawriter_topic)
399401 {
@@ -430,13 +432,13 @@ struct Locator : Entity
430432 * Collection of DataReaders using this locator.
431433 * The collection is ordered by the EntityId of the DataReader nodes.
432434 */
433- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
435+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
434436
435437 /*
436438 * Collection of DataWriters using this locator.
437439 * The collection is ordered by the EntityId of the DataWriter nodes.
438440 */
439- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
441+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
440442};
441443
442444} // namespace database
0 commit comments