Program Listing for File RTPSParticipantAllocationAttributes.hpp
↰ Return to documentation for file (include/fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp)
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP
#define FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
#include <fastdds/utils/collections/ResourceLimitedContainerConfig.hpp>
namespace eprosima {
namespace fastdds {
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) &&
(this->network_buffers_config == b.network_buffers_config);
}
size_t preallocated_number = 0u;
bool dynamic = false;
ResourceLimitedContainerConfig network_buffers_config = ResourceLimitedContainerConfig(16u,
std::numeric_limits<size_t>::max dummy_avoid_winmax (), 16u);
};
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) &&
(this->max_datasharing_domains == b.max_datasharing_domains);
}
size_t max_properties = 0;
size_t max_user_data = 0;
size_t max_partitions = 0;
size_t max_datasharing_domains = 0;
};
struct RTPSParticipantAllocationAttributes
{
RemoteLocatorsAllocationAttributes locators;
ResourceLimitedContainerConfig participants;
ResourceLimitedContainerConfig readers;
ResourceLimitedContainerConfig writers;
SendBuffersAllocationAttributes send_buffers;
VariableLengthDataLimits data_limits;
fastdds::rtps::ContentFilterProperty::AllocationConfiguration content_filter;
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();
} // namespace rtps
} // namespace fastdds
} // namespace eprosima
#endif // FASTDDS_RTPS_ATTRIBUTES__RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP