123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #ifndef _FASTDDS_RTPS_RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP_
- #define _FASTDDS_RTPS_RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP_
- #include <fastrtps/utils/collections/ResourceLimitedContainerConfig.hpp>
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- struct RemoteLocatorsAllocationAttributes
- {
- bool operator ==(
- const RemoteLocatorsAllocationAttributes& b) const
- {
- return (this->max_unicast_locators == b.max_unicast_locators) &&
- (this->max_multicast_locators == b.max_multicast_locators);
- }
-
- size_t max_unicast_locators = 4u;
-
- size_t max_multicast_locators = 1u;
- };
- struct SendBuffersAllocationAttributes
- {
- bool operator ==(
- const SendBuffersAllocationAttributes& b) const
- {
- return (this->preallocated_number == b.preallocated_number) &&
- (this->dynamic == b.dynamic);
- }
-
- size_t preallocated_number = 0u;
-
- bool dynamic = false;
- };
- struct VariableLengthDataLimits
- {
- bool operator ==(
- const VariableLengthDataLimits& b) const
- {
- return (this->max_properties == b.max_properties) &&
- (this->max_user_data == b.max_user_data) &&
- (this->max_partitions == b.max_partitions);
- }
-
- size_t max_properties = 0;
-
- size_t max_user_data = 0;
-
- size_t max_partitions = 0;
- };
- struct RTPSParticipantAllocationAttributes
- {
-
- RemoteLocatorsAllocationAttributes locators;
-
- ResourceLimitedContainerConfig participants;
-
- ResourceLimitedContainerConfig readers;
-
- ResourceLimitedContainerConfig writers;
-
- SendBuffersAllocationAttributes send_buffers;
-
- VariableLengthDataLimits data_limits;
-
- ResourceLimitedContainerConfig total_readers() const
- {
- return total_endpoints(readers);
- }
-
- ResourceLimitedContainerConfig total_writers() const
- {
- return total_endpoints(writers);
- }
- bool operator ==(
- const RTPSParticipantAllocationAttributes& b) const
- {
- return (this->locators == b.locators) &&
- (this->participants == b.participants) &&
- (this->readers == b.readers) &&
- (this->writers == b.writers) &&
- (this->send_buffers == b.send_buffers) &&
- (this->data_limits == b.data_limits);
- }
- private:
- ResourceLimitedContainerConfig total_endpoints(
- const ResourceLimitedContainerConfig& endpoints) const
- {
- constexpr size_t max = std::numeric_limits<size_t>::max();
- size_t initial;
- size_t maximum;
- size_t increment;
- initial = participants.initial * endpoints.initial;
- maximum = (participants.maximum == max || endpoints.maximum == max)
- ? max : participants.maximum * endpoints.maximum;
- increment = std::max(participants.increment, endpoints.increment);
- return { initial, maximum, increment };
- }
- };
- const RTPSParticipantAllocationAttributes c_default_RTPSParticipantAllocationAttributes
- = RTPSParticipantAllocationAttributes();
- }
- }
- }
- #endif
|