Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

CereConnHelpers.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef CERECONNHELPERS_H_324EA174
  2. #define CERECONNHELPERS_H_324EA174
  3. #include <boost/integer.hpp>
  4. #ifdef CC_TESTING_DEBUG
  5. #define FRIEND_TEST(test_case_name, test_name)\
  6. friend class test_case_name##_##test_name##_Test
  7. #endif
  8. namespace cc
  9. {
  10. template <typename T, int NumBits>
  11. using boost_integer_type =
  12. typename std::conditional<
  13. std::is_unsigned<T>::value,
  14. boost::uint_t<NumBits>,
  15. boost::int_t<NumBits>
  16. >::type;
  17. template <typename T>
  18. constexpr unsigned size_in_bits() { return sizeof(T) * CHAR_BIT; }
  19. template <typename T>
  20. using smallest_larger_integral_t =
  21. typename boost_integer_type<T, size_in_bits<T>() + 1>::least;
  22. template<typename InputIt1, typename InputIt2>
  23. bool it_chain_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2)
  24. {
  25. // loop through each element of old and new channel list
  26. for (; first1 != last1 and first2 != last2; ++ first1, ++ first2)
  27. {
  28. // if there's a mismatch, lists are different
  29. if (*first1 != *first2)
  30. {
  31. return false;
  32. }
  33. // if so far no mismatch and both list entries are 0, lists are equal
  34. if (*first1 == 0 && *first2 == 0)
  35. {
  36. return true;
  37. }
  38. }
  39. return (((first1 == last1) || (*first1 == 0)) && ((first2 == last2) || (*first2 == 0) ));
  40. }
  41. template<typename T, typename U>
  42. bool it_chain_equal(const T list1, const U list2)
  43. {
  44. return it_chain_equal(list1.cbegin(), list1.cend(), list2.cbegin(), list2.cend());
  45. }
  46. } /* cc */
  47. #endif /* end of include guard: CERECONNHELPERS_H_324EA174 */