FragmentNumber.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @file FragmentNumber.h
  16. */
  17. #ifndef _FASTDDS_RTPS_RPTS_ELEM_FRAGNUM_H_
  18. #define _FASTDDS_RTPS_RPTS_ELEM_FRAGNUM_H_
  19. #include <fastrtps/fastrtps_dll.h>
  20. #include <fastrtps/utils/fixed_size_bitmap.hpp>
  21. #include <fastdds/rtps/common/Types.h>
  22. #include <set>
  23. #include <cmath>
  24. #include <algorithm>
  25. namespace eprosima{
  26. namespace fastrtps{
  27. namespace rtps{
  28. using FragmentNumber_t = uint32_t;
  29. //!Structure FragmentNumberSet_t, contains a group of fragmentnumbers.
  30. //!@ingroup COMMON_MODULE
  31. using FragmentNumberSet_t = BitmapRange<FragmentNumber_t>;
  32. inline std::ostream& operator<<(std::ostream& output, const FragmentNumberSet_t& fns)
  33. {
  34. output << fns.base() << ":";
  35. fns.for_each([&](FragmentNumber_t it)
  36. {
  37. output << it << "-";
  38. });
  39. return output;
  40. }
  41. }
  42. }
  43. }
  44. #endif /* _FASTDDS_RTPS_RPTS_ELEM_FRAGNUM_H_ */