CXXR (C++ R)
Public Member Functions
CXXR::VectorOps::UnaryFunction< Functor, AttributeCopier, FunctorWrapper > Class Template Reference

Class used to transform a vector elementwise using unary function. More...

#include <UnaryFunction.hpp>

List of all members.

Public Member Functions

 UnaryFunction (const Functor &f=Functor())
 Constructor.
template<class Vout , class Vin >
Vout * apply (const Vin *v) const
 Apply a unary function to a vector.

Detailed Description

template<typename Functor, class AttributeCopier, template< typename, typename, typename > class FunctorWrapper = UnaryNAPropagator>
class CXXR::VectorOps::UnaryFunction< Functor, AttributeCopier, FunctorWrapper >

Class used to transform a vector elementwise using unary function.

An object of this class is used to map one vector into new vector of equal size, with each element of the output vector being obtained from the corresponding element of the input vector by the application of a unary function.

Template Parameters:
FunctorFunction or function object type, representing a unary function.
AttributeCopierThis class must define a static member function with the signature copyAttributes(VectorBase* to, const VectorBase* from). (Its return value, if any, is ignored.) The apply() method of UnaryFunction will invoke this member function to copy attributes from the unary function operand from to its result to. See the description of VectorOps::CopyAllAttributes for an example.
FunctorWrapperEach invocation of apply() will create an object of class FunctorWrapper<Functor>, and delegate to it the task of calling the unary function; the FunctorWrapper objects can then monitor any special conditions. See the description of VectorOps::UnaryNAPropagator for further information.

Constructor & Destructor Documentation

template<typename Functor , class AttributeCopier , template< typename, typename, typename > class FunctorWrapper = UnaryNAPropagator>
CXXR::VectorOps::UnaryFunction< Functor, AttributeCopier, FunctorWrapper >::UnaryFunction ( const Functor &  f = Functor())
inline

Constructor.

Parameters:
fPointer to an object of type Functor defining the unary function that this UnaryFunction object will use to generate an output vector from an input vector.

Member Function Documentation

template<typename Functor , class AttributeCopier , template< typename, typename, typename > class FunctorWrapper>
template<class Vout , class Vin >
Vout * CXXR::VectorOps::UnaryFunction< Functor, AttributeCopier, FunctorWrapper >::apply ( const Vin *  v) const

Apply a unary function to a vector.

Template Parameters:
VoutClass of vector to be produced as a result. It must be possible to assign values of the return type of f to the elements of a vector of type Vout .
VinClass of vector to be taken as input. It must be possible implicitly to convert the element data type of Vin to the input type of f .
Parameters:
vNon-null pointer to the input vector.
Returns:
Pointer to the result vector, a newly created vector of the same size as v .

The documentation for this class was generated from the following file: