25
25
#include < fastdds_statistics_backend/types/types.hpp>
26
26
#include < fastdds_statistics_backend/types/EntityId.hpp>
27
27
28
+ #include < types/fragile_ptr.hpp>
29
+
28
30
#include " data.hpp"
29
31
30
32
namespace eprosima {
@@ -118,7 +120,7 @@ struct Host : Entity
118
120
* Collection of users within the host which are involved in the communication.
119
121
* The collection is ordered by the EntityId of the user nodes.
120
122
*/
121
- std::map<EntityId, std::shared_ptr <User>> users;
123
+ std::map<EntityId, details::fragile_ptr <User>> users;
122
124
};
123
125
124
126
/*
@@ -128,7 +130,7 @@ struct User : Entity
128
130
{
129
131
User (
130
132
std::string user_name,
131
- std::shared_ptr <Host> user_host) noexcept
133
+ details::fragile_ptr <Host> user_host) noexcept
132
134
: Entity(EntityKind::USER, user_name, false , false )
133
135
, host(user_host)
134
136
{
@@ -140,13 +142,13 @@ struct User : Entity
140
142
void clear () final ;
141
143
142
144
// ! Reference to the Host in which this user runs
143
- std::shared_ptr <Host> host;
145
+ details::fragile_ptr <Host> host;
144
146
145
147
/*
146
148
* Collection of processes within the host which are involved in the communication.
147
149
* The collection is ordered by the EntityId of the process nodes.
148
150
*/
149
- std::map<EntityId, std::shared_ptr <Process>> processes;
151
+ std::map<EntityId, details::fragile_ptr <Process>> processes;
150
152
};
151
153
152
154
/*
@@ -157,7 +159,7 @@ struct Process : Entity
157
159
Process (
158
160
std::string process_name,
159
161
std::string process_id,
160
- std::shared_ptr <User> process_user) noexcept
162
+ details::fragile_ptr <User> process_user) noexcept
161
163
: Entity(EntityKind::PROCESS, process_name, false , false )
162
164
, pid(process_id)
163
165
, user(process_user)
@@ -173,13 +175,13 @@ struct Process : Entity
173
175
std::string pid;
174
176
175
177
// ! Reference to the User in which this process runs.
176
- std::shared_ptr <User> user;
178
+ details::fragile_ptr <User> user;
177
179
178
180
/*
179
181
* Collection of DomainParticipant within the process which are involved in the communication.
180
182
* The collection is ordered by the EntityId of the DomainParticipant nodes.
181
183
*/
182
- std::map<EntityId, std::shared_ptr <DomainParticipant>> participants;
184
+ std::map<EntityId, details::fragile_ptr <DomainParticipant>> participants;
183
185
};
184
186
185
187
/*
@@ -203,13 +205,13 @@ struct Domain : Entity
203
205
* Collection of Topics within the Domain which are either published, subscribed, or both.
204
206
* The collection is ordered by the EntityId of the Topic nodes.
205
207
*/
206
- std::map<EntityId, std::shared_ptr <Topic>> topics;
208
+ std::map<EntityId, details::fragile_ptr <Topic>> topics;
207
209
208
210
/*
209
211
* Collection of DomainParticipant within the Domain which are involved in the communication.
210
212
* The collection is ordered by the EntityId of the DomainParticipant nodes.
211
213
*/
212
- std::map<EntityId, std::shared_ptr <DomainParticipant>> participants;
214
+ std::map<EntityId, details::fragile_ptr <DomainParticipant>> participants;
213
215
};
214
216
215
217
/*
@@ -245,14 +247,14 @@ struct DDSEndpoint : DDSEntity
245
247
std::string endpoint_name = " INVALID" ,
246
248
Qos endpoint_qos = {},
247
249
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 ;
250
252
251
253
// ! Reference to the DomainParticipant in which this Endpoint runs.
252
- std::shared_ptr <DomainParticipant> participant;
254
+ details::fragile_ptr <DomainParticipant> participant;
253
255
254
256
// ! Reference to the Domain in which this endpoint publishes/subscribes.
255
- std::shared_ptr <Topic> topic;
257
+ details::fragile_ptr <Topic> topic;
256
258
257
259
// ! Flag to signal that this is a virtual endpoint used to collect meta traffic data.
258
260
bool is_virtual_metatraffic = false ;
@@ -261,7 +263,7 @@ struct DDSEndpoint : DDSEntity
261
263
* Collection of Locators related to this endpoint.
262
264
* The collection is ordered by the EntityId of the Locator nodes.
263
265
*/
264
- std::map<EntityId, std::shared_ptr <Locator>> locators;
266
+ std::map<EntityId, details::fragile_ptr <Locator>> locators;
265
267
};
266
268
267
269
/*
@@ -273,8 +275,8 @@ struct DomainParticipant : DDSEntity
273
275
std::string participant_name,
274
276
Qos participant_qos,
275
277
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
278
280
: DDSEntity(EntityKind::PARTICIPANT, participant_name, participant_qos, participant_guid)
279
281
, process(participant_process)
280
282
, domain(participant_domain)
@@ -287,28 +289,28 @@ struct DomainParticipant : DDSEntity
287
289
void clear () final ;
288
290
289
291
template <typename T>
290
- std::map<EntityId, std::shared_ptr <T>>& ddsendpoints ();
292
+ std::map<EntityId, details::fragile_ptr <T>>& ddsendpoints ();
291
293
292
294
// ! Reference to the Process in which this DomainParticipant runs.
293
- std::shared_ptr <Process> process;
295
+ details::fragile_ptr <Process> process;
294
296
295
297
// ! Reference to the Domain in which this DomainParticipant runs.
296
- std::shared_ptr <Domain> domain;
298
+ details::fragile_ptr <Domain> domain;
297
299
298
300
// ! 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;
300
302
301
303
/*
302
304
* Collection of DataReaders within the DomainParticipant which are involved in the communication.
303
305
* The collection is ordered by the EntityId of the DataReader nodes.
304
306
*/
305
- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
307
+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
306
308
307
309
/*
308
310
* Collection of DataWriters within the DomainParticipant which are involved in the communication.
309
311
* The collection is ordered by the EntityId of the DataWriter nodes.
310
312
*/
311
- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
313
+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
312
314
313
315
// ! Actual statistical data reported by Fast DDS Statistics Module regarding this DomainParticipant.
314
316
DomainParticipantData data;
@@ -323,7 +325,7 @@ struct Topic : Entity
323
325
Topic (
324
326
std::string topic_name,
325
327
std::string topic_type,
326
- std::shared_ptr <Domain> topic_domain) noexcept
328
+ details::fragile_ptr <Domain> topic_domain) noexcept
327
329
: Entity(EntityKind::TOPIC, topic_name, is_metatraffic_topic(topic_name))
328
330
, data_type(topic_type)
329
331
, domain(topic_domain)
@@ -336,25 +338,25 @@ struct Topic : Entity
336
338
void clear () final ;
337
339
338
340
template <typename T>
339
- std::map<EntityId, std::shared_ptr <T>>& ddsendpoints ();
341
+ std::map<EntityId, details::fragile_ptr <T>>& ddsendpoints ();
340
342
341
343
// ! The data type name of the topic
342
344
std::string data_type;
343
345
344
346
// ! Reference to the Domain in which this topic is published/subscribed.
345
- std::shared_ptr <Domain> domain;
347
+ details::fragile_ptr <Domain> domain;
346
348
347
349
/*
348
350
* Collection of Datareaders subscribing to this topic.
349
351
* The collection is ordered by the EntityId of the Datareader nodes.
350
352
*/
351
- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
353
+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
352
354
353
355
/*
354
356
* Collection of DataWriters publishind in this topic.
355
357
* The collection is ordered by the EntityId of the DataWriter nodes.
356
358
*/
357
- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
359
+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
358
360
};
359
361
360
362
/*
@@ -366,8 +368,8 @@ struct DataReader : DDSEndpoint
366
368
std::string datareader_name,
367
369
Qos datareader_qos,
368
370
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
371
373
: DDSEndpoint(EntityKind::DATAREADER, datareader_name, datareader_qos, datareader_guid, datareader_participant,
372
374
datareader_topic)
373
375
{
@@ -392,8 +394,8 @@ struct DataWriter : DDSEndpoint
392
394
std::string datawriter_name,
393
395
Qos datawriter_qos,
394
396
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
397
399
: DDSEndpoint(EntityKind::DATAWRITER, datawriter_name, datawriter_qos, datawriter_guid, datawriter_participant,
398
400
datawriter_topic)
399
401
{
@@ -430,13 +432,13 @@ struct Locator : Entity
430
432
* Collection of DataReaders using this locator.
431
433
* The collection is ordered by the EntityId of the DataReader nodes.
432
434
*/
433
- std::map<EntityId, std::shared_ptr <DataReader>> data_readers;
435
+ std::map<EntityId, details::fragile_ptr <DataReader>> data_readers;
434
436
435
437
/*
436
438
* Collection of DataWriters using this locator.
437
439
* The collection is ordered by the EntityId of the DataWriter nodes.
438
440
*/
439
- std::map<EntityId, std::shared_ptr <DataWriter>> data_writers;
441
+ std::map<EntityId, details::fragile_ptr <DataWriter>> data_writers;
440
442
};
441
443
442
444
} // namespace database
0 commit comments