Program Listing for File ResourceLimitedContainerConfig.hpp
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastrtps/utils/collections/ResourceLimitedContainerConfig.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 FASTRTPS_UTILS_COLLECTIONS_RESOURCELIMITEDCONTAINERCONFIG_HPP_
#define FASTRTPS_UTILS_COLLECTIONS_RESOURCELIMITEDCONTAINERCONFIG_HPP_
#include <cstddef>
#include <limits>
namespace eprosima {
namespace fastrtps {
#define dummy_avoid_winmax
struct ResourceLimitedContainerConfig
{
ResourceLimitedContainerConfig(
size_t ini = 0,
size_t max = std::numeric_limits<size_t>::max dummy_avoid_winmax (),
size_t inc = 1u)
: initial(ini)
, maximum(max)
, increment(inc)
{
}
size_t initial = 0;
size_t maximum = std::numeric_limits<size_t>::max dummy_avoid_winmax ();
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 dummy_avoid_winmax (), 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;
}
} // namespace fastrtps
} // namespace eprosima
#endif /* FASTRTPS_UTILS_COLLECTIONS_RESOURCELIMITEDCONTAINERCONFIG_HPP_ */