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
42 #include <type_traits>
46 #include <boost/iterator/transform_iterator.hpp>
47 #include <boost/concept/assert.hpp>
49 #include "DGtal/kernel/domains/CDomain.h"
50 #include "DGtal/base/FunctorHolder.h"
142 template <
class TGivenFunctor >
145 ,
myFunctor( std::forward<TGivenFunctor>(aFunctor) )
168 template <
typename TPo
int>
175 "The point is outside the domain."
180 template <
typename TPo
int>
187 "The point is outside the domain."
208 out <<
"[ConstImageFunctorHolder] holding a " <<
myFunctor <<
" on domain " <<
myDomain;
252 template <
typename TDomain,
typename TValue,
typename TFunctor>
256 object.selfDisplay(out);
308 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>()))>::type,
309 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
314 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>()))>::type,
315 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
316 >{ aDomain,
holdFunctor(std::forward<TFunctor>(aFunctor)) };
326 -> ConstImageFunctorHolder<
328 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>(), aDomain))>::type,
329 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
332 return ConstImageFunctorHolder<
334 typename std::decay<decltype(aFunctor(std::declval<typename TDomain::Point>(), aDomain))>::type,
335 decltype(
holdFunctor(std::forward<TFunctor>(aFunctor)))
336 >{ aDomain,
holdFunctor(std::forward<TFunctor>(aFunctor)) };
346 #undef ConstImageFunctorHolder_RECURSES
Iterator for HyperRectDomain.
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)
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
std::reverse_iterator< ConstIterator > ConstReverseIterator
Domain myDomain
The image domain.
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
DigitalPlane::Point Vector
Point::Coordinate Integer
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...
HalfEdgeDataStructure::Size Size
Image::ConstRange ConstRange