update boost on linux
This commit is contained in:
@@ -1,41 +1,26 @@
|
||||
/*
|
||||
Copyright 2005-2007 Adobe Systems Incorporated
|
||||
|
||||
Use, modification and distribution are subject to the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// Copyright 2005-2007 Adobe Systems Incorporated
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_PLANAR_PIXEL_ITERATOR_HPP
|
||||
#define BOOST_GIL_PLANAR_PIXEL_ITERATOR_HPP
|
||||
|
||||
See http://opensource.adobe.com/gil for most recent version including documentation.
|
||||
*/
|
||||
#include <boost/gil/pixel.hpp>
|
||||
#include <boost/gil/step_iterator.hpp>
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#ifndef GIL_PLANAR_PTR_H
|
||||
#define GIL_PLANAR_PTR_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file
|
||||
/// \brief planar pixel pointer class
|
||||
/// \author Lubomir Bourdev and Hailin Jin \n
|
||||
/// Adobe Systems Incorporated
|
||||
/// \date 2005-2007 \n Last updated on February 12, 2007
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include "gil_config.hpp"
|
||||
#include "pixel.hpp"
|
||||
#include "step_iterator.hpp"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
//forward declaration (as this file is included in planar_pixel_reference.hpp)
|
||||
template <typename ChannelReference, typename ColorSpace>
|
||||
template <typename ChannelReference, typename ColorSpace>
|
||||
struct planar_pixel_reference;
|
||||
|
||||
/// \defgroup ColorBaseModelPlanarPtr planar_pixel_iterator
|
||||
/// \defgroup ColorBaseModelPlanarPtr planar_pixel_iterator
|
||||
/// \ingroup ColorBaseModel
|
||||
/// \brief A homogeneous color base whose element is a channel iterator. Models HomogeneousColorBaseValueConcept
|
||||
/// This class is used as an iterator to a planar pixel.
|
||||
@@ -49,7 +34,7 @@ struct planar_pixel_reference;
|
||||
///
|
||||
/// Planar pixels have channel data that is not consecutive in memory.
|
||||
/// To abstract this we use classes to represent references and pointers to planar pixels.
|
||||
///
|
||||
///
|
||||
/// \ingroup PixelIteratorModelPlanarPtr ColorBaseModelPlanarPtr PixelBasedModel
|
||||
template <typename ChannelPtr, typename ColorSpace>
|
||||
struct planar_pixel_iterator : public iterator_facade<planar_pixel_iterator<ChannelPtr,ColorSpace>,
|
||||
@@ -58,18 +43,18 @@ struct planar_pixel_iterator : public iterator_facade<planar_pixel_iterator<Chan
|
||||
const planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace> >,
|
||||
public detail::homogeneous_color_base<ChannelPtr,layout<ColorSpace>,mpl::size<ColorSpace>::value > {
|
||||
private:
|
||||
typedef iterator_facade<planar_pixel_iterator<ChannelPtr,ColorSpace>,
|
||||
pixel<typename std::iterator_traits<ChannelPtr>::value_type,layout<ColorSpace> >,
|
||||
using parent_t = iterator_facade<planar_pixel_iterator<ChannelPtr,ColorSpace>,
|
||||
pixel<typename std::iterator_traits<ChannelPtr>::value_type,layout<ColorSpace>>,
|
||||
std::random_access_iterator_tag,
|
||||
const planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace> > parent_t;
|
||||
typedef detail::homogeneous_color_base<ChannelPtr,layout<ColorSpace>,mpl::size<ColorSpace>::value> color_base_parent_t;
|
||||
typedef typename std::iterator_traits<ChannelPtr>::value_type channel_t;
|
||||
const planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>>;
|
||||
using color_base_parent_t = detail::homogeneous_color_base<ChannelPtr,layout<ColorSpace>,mpl::size<ColorSpace>::value>;
|
||||
using channel_t = typename std::iterator_traits<ChannelPtr>::value_type;
|
||||
public:
|
||||
typedef typename parent_t::value_type value_type;
|
||||
typedef typename parent_t::reference reference;
|
||||
typedef typename parent_t::difference_type difference_type;
|
||||
using value_type = typename parent_t::value_type;
|
||||
using reference = typename parent_t::reference;
|
||||
using difference_type = typename parent_t::difference_type;
|
||||
|
||||
planar_pixel_iterator() : color_base_parent_t(0) {}
|
||||
planar_pixel_iterator() : color_base_parent_t(0) {}
|
||||
planar_pixel_iterator(bool) {} // constructor that does not fill with zero (for performance)
|
||||
|
||||
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1) : color_base_parent_t(v0,v1) {}
|
||||
@@ -77,20 +62,19 @@ public:
|
||||
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3) : color_base_parent_t(v0,v1,v2,v3) {}
|
||||
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3, const ChannelPtr& v4) : color_base_parent_t(v0,v1,v2,v3,v4) {}
|
||||
|
||||
template <typename IC1,typename C1>
|
||||
template <typename IC1,typename C1>
|
||||
planar_pixel_iterator(const planar_pixel_iterator<IC1,C1>& ptr) : color_base_parent_t(ptr) {}
|
||||
|
||||
|
||||
/// Copy constructor and operator= from pointers to compatible planar pixels or planar pixel references.
|
||||
/// That allow constructs like pointer = &value or pointer = &reference
|
||||
/// Since we should not override operator& that's the best we can do.
|
||||
template <typename P>
|
||||
template <typename P>
|
||||
planar_pixel_iterator(P* pix) : color_base_parent_t(pix, true) {
|
||||
function_requires<PixelsCompatibleConcept<P,value_type> >();
|
||||
}
|
||||
|
||||
struct address_of { template <typename T> T* operator()(T& t) { return &t; } };
|
||||
template <typename P>
|
||||
template <typename P>
|
||||
planar_pixel_iterator& operator=(P* pix) {
|
||||
function_requires<PixelsCompatibleConcept<P,value_type> >();
|
||||
static_transform(*pix,*this, address_of());
|
||||
@@ -116,10 +100,10 @@ private:
|
||||
|
||||
void increment() { static_transform(*this,*this,detail::inc<ChannelPtr>()); }
|
||||
void decrement() { static_transform(*this,*this,detail::dec<ChannelPtr>()); }
|
||||
void advance(ptrdiff_t d) { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric<ChannelPtr,ptrdiff_t>(),d)); }
|
||||
void advance(std::ptrdiff_t d){ static_transform(*this,*this,std::bind(detail::plus_asymmetric<ChannelPtr,std::ptrdiff_t>(),std::placeholders::_1,d)); }
|
||||
reference dereference() const { return this->template deref<reference>(); }
|
||||
|
||||
ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return gil::at_c<0>(it)-gil::at_c<0>(*this); }
|
||||
std::ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return gil::at_c<0>(it)-gil::at_c<0>(*this); }
|
||||
bool equal(const planar_pixel_iterator& it) const { return gil::at_c<0>(*this)==gil::at_c<0>(it); }
|
||||
};
|
||||
|
||||
@@ -128,31 +112,31 @@ namespace detail {
|
||||
template <typename T> struct channel_iterator_is_mutable<const T*> : public mpl::false_ {};
|
||||
}
|
||||
|
||||
template <typename IC, typename C>
|
||||
struct const_iterator_type<planar_pixel_iterator<IC,C> > {
|
||||
template <typename IC, typename C>
|
||||
struct const_iterator_type<planar_pixel_iterator<IC,C> > {
|
||||
private:
|
||||
typedef typename std::iterator_traits<IC>::value_type channel_t;
|
||||
using channel_t = typename std::iterator_traits<IC>::value_type;
|
||||
public:
|
||||
typedef planar_pixel_iterator<typename channel_traits<channel_t>::const_pointer,C> type;
|
||||
using type = planar_pixel_iterator<typename channel_traits<channel_t>::const_pointer,C>;
|
||||
};
|
||||
|
||||
// The default implementation when the iterator is a C pointer is to use the standard constness semantics
|
||||
template <typename IC, typename C>
|
||||
template <typename IC, typename C>
|
||||
struct iterator_is_mutable<planar_pixel_iterator<IC,C> > : public detail::channel_iterator_is_mutable<IC> {};
|
||||
|
||||
/////////////////////////////
|
||||
// ColorBasedConcept
|
||||
/////////////////////////////
|
||||
|
||||
template <typename IC, typename C, int K>
|
||||
template <typename IC, typename C, int K>
|
||||
struct kth_element_type<planar_pixel_iterator<IC,C>, K> {
|
||||
typedef IC type;
|
||||
using type = IC;
|
||||
};
|
||||
|
||||
template <typename IC, typename C, int K>
|
||||
template <typename IC, typename C, int K>
|
||||
struct kth_element_reference_type<planar_pixel_iterator<IC,C>, K> : public add_reference<IC> {};
|
||||
|
||||
template <typename IC, typename C, int K>
|
||||
template <typename IC, typename C, int K>
|
||||
struct kth_element_const_reference_type<planar_pixel_iterator<IC,C>, K> : public add_reference<typename add_const<IC>::type> {};
|
||||
|
||||
/////////////////////////////
|
||||
@@ -161,7 +145,7 @@ struct kth_element_const_reference_type<planar_pixel_iterator<IC,C>, K> : public
|
||||
|
||||
template <typename IC, typename C>
|
||||
struct color_space_type<planar_pixel_iterator<IC,C> > {
|
||||
typedef C type;
|
||||
using type = C;
|
||||
};
|
||||
|
||||
template <typename IC, typename C>
|
||||
@@ -172,7 +156,7 @@ struct is_planar<planar_pixel_iterator<IC,C> > : public mpl::true_ {};
|
||||
|
||||
template <typename IC, typename C>
|
||||
struct channel_type<planar_pixel_iterator<IC,C> > {
|
||||
typedef typename std::iterator_traits<IC>::value_type type;
|
||||
using type = typename std::iterator_traits<IC>::value_type;
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
@@ -183,8 +167,8 @@ template <typename IC, typename C>
|
||||
inline std::ptrdiff_t memunit_step(const planar_pixel_iterator<IC,C>&) { return sizeof(typename std::iterator_traits<IC>::value_type); }
|
||||
|
||||
template <typename IC, typename C>
|
||||
inline std::ptrdiff_t memunit_distance(const planar_pixel_iterator<IC,C>& p1, const planar_pixel_iterator<IC,C>& p2) {
|
||||
return memunit_distance(gil::at_c<0>(p1),gil::at_c<0>(p2));
|
||||
inline std::ptrdiff_t memunit_distance(const planar_pixel_iterator<IC,C>& p1, const planar_pixel_iterator<IC,C>& p2) {
|
||||
return memunit_distance(gil::at_c<0>(p1),gil::at_c<0>(p2));
|
||||
}
|
||||
|
||||
template <typename IC>
|
||||
@@ -196,7 +180,7 @@ struct memunit_advance_fn {
|
||||
};
|
||||
|
||||
template <typename IC, typename C>
|
||||
inline void memunit_advance(planar_pixel_iterator<IC,C>& p, std::ptrdiff_t diff) {
|
||||
inline void memunit_advance(planar_pixel_iterator<IC,C>& p, std::ptrdiff_t diff) {
|
||||
static_transform(p, p, memunit_advance_fn<IC>(diff));
|
||||
}
|
||||
|
||||
@@ -208,7 +192,7 @@ inline planar_pixel_iterator<IC,C> memunit_advanced(const planar_pixel_iterator<
|
||||
}
|
||||
|
||||
template <typename ChannelPtr, typename ColorSpace>
|
||||
inline planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>
|
||||
inline planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>
|
||||
memunit_advanced_ref(const planar_pixel_iterator<ChannelPtr,ColorSpace>& ptr, std::ptrdiff_t diff) {
|
||||
return planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>(ptr, diff);
|
||||
}
|
||||
@@ -219,9 +203,8 @@ inline planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::referen
|
||||
|
||||
template <typename IC, typename C>
|
||||
struct dynamic_x_step_type<planar_pixel_iterator<IC,C> > {
|
||||
typedef memory_based_step_iterator<planar_pixel_iterator<IC,C> > type;
|
||||
using type = memory_based_step_iterator<planar_pixel_iterator<IC,C>>;
|
||||
};
|
||||
|
||||
} } // namespace boost::gil
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user