123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef FASTRTPS_UTILS_COLLECTIONS_RESOURCELIMITEDCONTAINERCONFIG_HPP_
- #define FASTRTPS_UTILS_COLLECTIONS_RESOURCELIMITEDCONTAINERCONFIG_HPP_
- #include <cstddef>
- #include <limits>
- namespace eprosima {
- namespace fastrtps {
- struct ResourceLimitedContainerConfig
- {
- ResourceLimitedContainerConfig(
- size_t ini = 0,
- size_t max = std::numeric_limits<size_t>::max(),
- size_t inc = 1u)
- : initial(ini)
- , maximum(max)
- , increment(inc)
- {
- }
-
- size_t initial = 0;
-
- size_t maximum = std::numeric_limits<size_t>::max();
-
- size_t increment = 1u;
-
- inline static ResourceLimitedContainerConfig fixed_size_configuration(size_t size)
- {
- return ResourceLimitedContainerConfig(size, size, 0u);
- }
-
- inline static ResourceLimitedContainerConfig dynamic_allocation_configuration(size_t increment = 1u)
- {
- return ResourceLimitedContainerConfig(0u, std::numeric_limits<size_t>::max(), increment ? increment : 1u);
- }
- };
- inline bool operator == (
- const ResourceLimitedContainerConfig& lhs,
- const ResourceLimitedContainerConfig& rhs)
- {
- return
- lhs.maximum == rhs.maximum &&
- lhs.initial == rhs.initial &&
- lhs.increment == rhs.increment;
- }
- }
- }
- #endif
|