29 #if defined(ConstImageFunctorHolder_RECURSES)
30 #error Recursive header files inclusion detected in ConstImageFunctorHolder.h
31 #else // defined(ConstImageFunctorHolder_RECURSES)
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)) };
344 #endif // !defined ConstImageFunctorHolder_h
346 #undef ConstImageFunctorHolder_RECURSES
347 #endif // else defined(ConstImageFunctorHolder_RECURSES)
ConstReverseIterator rbegin(Point const &aPoint) const
Space::Dimension Dimension
typename Self::Point Point
Transform a point-dependent (and possibly domain-dependent) functor into a constant image.
typename Domain::Size Size
ConstReverseIterator rbegin() const
typename Domain::Integer Integer
typename Domain::Vector Vector
BOOST_STATIC_CONSTANT(Dimension, dimension=Domain::Space::dimension)
Functor myFunctor
The functor that generates the image.
Domain myDomain
The image domain.
Domain const & domain() const
Returns the associated domain.
ConstIterator end() const
HalfEdgeDataStructure::Size Size
constexpr bool isValid() const
Checks the validity/consistency of the object.
ConstImageFunctorHolder(Domain const &aDomain, TGivenFunctor &&aFunctor)
Constructor.
auto operator()(TPoint const &aPoint) const -> decltype(myFunctor(aPoint))
Evaluates the functor at the given point.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
DGtal is the top-level namespace which contains all DGtal functions and types.
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.
Image::ConstRange ConstRange
ConstIterator begin() const
Constant range on a ConstImageFunctorHolder.
BOOST_CONCEPT_ASSERT((DGtal::concepts::CDomain< TDomain >))
std::ostream & operator<<(std::ostream &out, const FunctorHolder< FunctorStorage, NeedDereference > &object)
Overloads 'operator<<' for displaying objects of class FunctorHolder.
void selfDisplay(std::ostream &out) const
Writes/Displays the object on an output stream.
std::reverse_iterator< ConstIterator > ConstReverseIterator
FreemanChain< int >::Vector Vector
Iterator for HyperRectDomain.
typename Self::ConstReverseIterator ConstReverseIterator
boost::transform_iterator< std::reference_wrapper< const Self >, typename Domain::ConstIterator > ConstIterator
Self const & myConstImageFunctorHolder
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.
typename Domain::Dimension Dimension
ConstIterator begin(Point const &aPoint) const
ConstRange(Self const &aConstImageFunctorHolder)
ConstReverseIterator rend() const
ConstRange constRange() const
Returns a constant range over this image.
typename Domain::Point Point
typename Self::ConstIterator ConstIterator