8 #ifndef BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP 9 #define BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP 11 #include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp> 13 #include <boost/gil/io/error.hpp> 15 #include <boost/mpl/at.hpp> 16 #include <boost/mpl/size.hpp> 18 namespace boost {
namespace gil {
23 struct construct_matched_t {
24 template <
typename Images,
typename Pred>
25 static bool apply(any_image<Images>& im,Pred pred) {
26 if (pred.template apply<
typename mpl::at_c<Images,N-1>::type>()) {
30 }
else return construct_matched_t<N-1>::apply(im,pred);
34 struct construct_matched_t<0> {
35 template <
typename Images,
typename Pred>
36 static bool apply(any_image<Images>&,Pred) {
return false;}
42 template <
typename IsSupported,
typename OpClass>
43 class dynamic_io_fnobj {
46 template <
typename View>
47 void apply(
const View&
view,mpl::true_ ) {_op->apply(view);}
49 template <
typename View,
typename Info >
50 void apply(
const View& view
55 _op->apply( view, info );
58 template <
typename View>
59 void apply(
const View& ,mpl::false_) {io_error(
"dynamic_io: unsupported view type for the given file format");}
61 template <
typename View,
typename Info >
62 void apply(
const View&
67 io_error(
"dynamic_io: unsupported view type for the given file format" );
71 dynamic_io_fnobj(OpClass* op) : _op(op) {}
73 using result_type = void;
75 template <
typename View>
76 void operator()(
const View& view) {apply(view,
typename IsSupported::template apply<View>::type());}
78 template<
typename View,
typename Info >
79 void operator()(
const View& view,
const Info& info )
83 ,
typename IsSupported::template apply< View >::type()
93 template <
typename Images,
typename Pred>
94 inline bool construct_matched(any_image<Images>& im,Pred pred) {
95 return detail::construct_matched_t<mpl::size<Images>::value>::apply(im,pred);
Definition: algorithm.hpp:30
add_reference< E >::type at_c(detail::homogeneous_color_base< E, L, N > &p)
Provides mutable access to the K-th element, in physical order.
Definition: color_base.hpp:387
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:460