29#if defined(ConstImageFunctorHolder_RECURSES)
30#error Recursive header files inclusion detected in ConstImageFunctorHolder.h
33#define ConstImageFunctorHolder_RECURSES
35#if !defined ConstImageFunctorHolder_h
37#define ConstImageFunctorHolder_h
46#include <boost/iterator/transform_iterator.hpp>
47#include <boost/concept/assert.hpp>
48#include <boost/iterator/reverse_iterator.hpp>
50#include "DGtal/kernel/domains/CDomain.h"
51#include "DGtal/base/FunctorHolder.h"
143 template <
class TGivenFunctor >
169 template <
typename TPo
int>
176 "The point is outside the domain."
181 template <
typename TPo
int>
188 "The point is outside the domain."
209 out <<
"[ConstImageFunctorHolder] holding a " <<
myFunctor <<
" on domain " <<
myDomain;
253template <
typename TDomain,
typename TValue,
typename TFunctor>
257 object.selfDisplay(out);
309 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>()))>::type,
310 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
315 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>()))>::type,
316 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
317 >{ aDomain,
holdFunctor(std::forward<TFunctor>(aFunctor)) };
327 -> ConstImageFunctorHolder<
329 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>(), aDomain))>::type,
330 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
333 return ConstImageFunctorHolder<
335 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>(), aDomain))>::type,
336 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
337 >{ aDomain,
holdFunctor(std::forward<TFunctor>(aFunctor)) };
347#undef ConstImageFunctorHolder_RECURSES
Space::Dimension Dimension
Constant range on a ConstImageFunctorHolder.
ConstReverseIterator rbegin() const
ConstRange(Self const &aConstImageFunctorHolder)
ConstReverseIterator rbegin(Point const &aPoint) const
ConstReverseIterator rend() const
typename Self::ConstIterator ConstIterator
typename Self::Point Point
typename Self::ConstReverseIterator ConstReverseIterator
Self const & myConstImageFunctorHolder
ConstIterator end() const
ConstIterator begin() const
ConstIterator begin(Point const &aPoint) const
Transform a point-dependent (and possibly domain-dependent) functor into a constant image.
BOOST_STATIC_CONSTANT(Dimension, dimension=Domain::Space::dimension)
boost::reverse_iterator< ConstIterator > ConstReverseIterator
auto operator()(TPoint const &aPoint) const -> decltype(myFunctor(aPoint))
Evaluates the functor at the given point.
ConstImageFunctorHolder(Domain const &aDomain, TGivenFunctor &&aFunctor)
Constructor.
typename Domain::Integer Integer
Domain const & domain() const
Returns the associated domain.
void selfDisplay(std::ostream &out) const
Writes/Displays the object on an output stream.
boost::transform_iterator< std::reference_wrapper< const Self >, typename Domain::ConstIterator > ConstIterator
Domain myDomain
The image domain.
ConstImageFunctorHolder< TDomain, TValue, TFunctor > Self
constexpr bool isValid() const
Checks the validity/consistency of the object.
typename Domain::Point Point
BOOST_CONCEPT_ASSERT((DGtal::concepts::CDomain< TDomain >))
typename Domain::Vector Vector
ConstRange constRange() const
Returns a constant range over this image.
Functor myFunctor
The functor that generates the image.
typename Domain::Dimension Dimension
typename Domain::Size Size
functors namespace gathers all DGtal functors.
std::ostream & operator<<(std::ostream &out, const FunctorHolder< FunctorStorage, NeedDereference > &object)
Overloads 'operator<<' for displaying objects of class FunctorHolder.
auto holdFunctor(Function &&fn) -> decltype(holdFunctorImpl(std::forward< Function >(fn), typename std::is_lvalue_reference< Function >{}))
Hold any callable object (function, functor, lambda, ...) as a C(Unary)Functor model.
auto holdConstImageFunctor(TDomain const &aDomain, TFunctor &&aFunctor) -> ConstImageFunctorHolder< TDomain, TValue, decltype(holdFunctor(std::forward< TFunctor >(aFunctor)))>
ConstImageFunctorHolder construction helper with specification of the return type.
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Image::ConstRange ConstRange