Commit b602e2d4 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Fix image concepts + concept tests for clip.

parent de4b1cd3
Pipeline #12858 failed with stages
in 7 minutes and 24 seconds
......@@ -3,6 +3,9 @@
#include <mln/core/concept/new/cmcstl2.hpp>
#include <mln/core/concept/new/points.hpp>
#include <mln/core/concept/new/values.hpp>
#include <range/v3/range_traits.hpp>
#include <type_traits>
namespace mln::concepts
......@@ -14,10 +17,10 @@ namespace mln::concepts
// Domain
template <typename Dom>
concept Domain =
concept Domain =
stl::ForwardRange<Dom> &&
Point<domain_point_t<Dom>> &&
requires(const Dom cdom, stl::range_value_t<Dom> p) {
Point<::ranges::range_value_t<Dom>> &&
requires(const Dom cdom, ::ranges::range_value_t<Dom> p) {
{ cdom.has(p) } -> bool;
{ cdom.empty() } -> bool;
// { cdom.size() } -> stl::UnsignedIntegral&&;
......
......@@ -84,7 +84,7 @@ namespace mln
auto new_pixels()
{
auto g = [this](point_type p) -> new_pixel_type { return this->base().pixel_at(p); };
auto g = [this](point_type p) -> new_pixel_type { return this->base().new_pixel_at(p); };
return mln::ranges::view::transform(this->m_domain, g);
}
......
#ifndef MLN_CORE_IMAGE_TRAITS_HPP
#define MLN_CORE_IMAGE_TRAITS_HPP
#include <mln/core/concept/object.hpp>
#include <mln/core/extension/extension_traits.hpp>
#include <mln/core/image_category.hpp>
......@@ -36,23 +37,42 @@ namespace mln
template <class I>
struct Image;
template <typename I>
struct image_traits : image_traits<typename std::decay<I>::type>
namespace experimental
{
template <class I>
struct Image;
};
template <typename I>
struct image_traits<const I> : image_traits<I>
{
};
struct [[deprecated]] image_traits;
template <typename I>
struct image_traits<volatile I> : image_traits<I>
namespace details
{
template <typename I, class = void>
struct image_traits_helper;
template <typename I>
struct image_traits_helper<I, std::enable_if_t<mln::is_a<I, mln::experimental::Image>::value>>
{
using category = typename I::category_type;
using extension = typename I::extension_category;
using accessible = typename I::accessible;
using indexable = typename I::indexable;
};
template <typename I>
struct image_traits_helper<I, std::enable_if_t<!mln::is_a<I, mln::experimental::Image>::value>>
: image_traits<std::decay_t<I>>
{
};
};
template <typename I>
struct image_traits<const volatile I> : image_traits<I>
struct image_traits : details::image_traits_helper<I>
{
};
......
......@@ -105,8 +105,8 @@ TEST(View, clip_other_a_box2d)
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert(mln::concept::AccessibleImage<mln::clip_view<mln::archetypes::AccessibleImage, mln::archetypes::Domain>>);
static_assert(mln::concept::OutputImage<mln::clip_view<mln::archetypes::OutputAccessibleImage, mln::archetypes::Domain>>);
static_assert(mln::concept::IndexableAndAccessibleImage<mln::clip_view<mln::archetypes::IndexableAndAccessibleImage, mln::archetypes::Domain>>);
static_assert(mln::concepts::AccessibleImage<mln::clip_view<mln::archetypes::AccessibleImage, mln::archetypes::Domain>>);
static_assert(mln::concepts::OutputImage<mln::clip_view<mln::archetypes::OutputAccessibleImage, mln::archetypes::Domain>>);
static_assert(mln::concepts::IndexableAndAccessibleImage<mln::clip_view<mln::archetypes::IndexableAndAccessibleImage, mln::archetypes::Domain>>);
#endif // PYLENE_CONCEPT_TS_ENABLED
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment