CXXR (C++ R)
Public Types | Public Member Functions
CXXR::VectorOps::NullUnaryFunctorWrapper< Functor > Class Template Reference

Monitor function application for unary functions. More...

#include <UnaryFunction.hpp>

List of all members.

Public Types

typedef Functor::argument_type argument_type
typedef Functor::result_type result_type

Public Member Functions

 NullUnaryFunctorWrapper (const Functor &f)
 Constructor.
result_type operator() (const argument_type &in) const
 Monitored invocation of f .
void warnings ()
 Raise warnings after processing a vector.

Detailed Description

template<class Functor>
class CXXR::VectorOps::NullUnaryFunctorWrapper< Functor >

Monitor function application for unary functions.

VectorOps::UnaryFunction takes as a template parameter a FunctorWrapper class. The apply() method of UnaryFunction creates an object of the FunctorWrapper class, and delegates to it the task of calling the unary function; the FunctorWrapper object can then monitor any abnormal conditions that occur, and take appropriate action either immediately (typically by raising an error) or when processing of the input vector is complete (typically by providing one or more warnings).

This class is the default value of the FunctorWrapper template parameter, and its behaviour is to apply no monitoring at all. If different behaviour is required, another class can be created using this class as a model.

Template Parameters:
Functora function object class inheriting from an instantiation of the std::unary_function template (or otherwise defining nested types result_type and argument_type appropriately).

Constructor & Destructor Documentation

template<class Functor >
CXXR::VectorOps::NullUnaryFunctorWrapper< Functor >::NullUnaryFunctorWrapper ( const Functor &  f)
inline

Constructor.

Parameters:
fPointer to an object of type Functor defining the unary function whose operation this FunctorWrapper is to monitor.

Member Function Documentation

template<class Functor >
result_type CXXR::VectorOps::NullUnaryFunctorWrapper< Functor >::operator() ( const argument_type &  in) const
inline

Monitored invocation of f .

The apply() method of an object instantiating the VectorOps::UnaryFunction template will call this function to generate a value for the output vector from a value from the input vector using the functor f . This function will monitor the operation of f , and take appropriate action if abnormalities occur, for example by raising an error, modifying the return value, and/or recording the abnormality for later reporting by warnings().

Parameters:
inInput value to which f is to be applied.
Returns:
The result of applying f to in , possibly modified if abnormalities occurred.
template<class Functor >
void CXXR::VectorOps::NullUnaryFunctorWrapper< Functor >::warnings ( )
inline

Raise warnings after processing a vector.

The apply() method of an object instantiating the VectorOps::UnaryFunction template will call this function once all the elements of the input vector have been processed. Typically this function will do nothing if no abnormalities have occurred during the lifetime of this FunctorWrapper object , otherwise it will raise one or more warnings. (Note that the lifetime of a FunctorWrapper object corresponds to the processing of an input vector by the apply() method of UnaryFunction.)

The default behaviour, implemented here, is to do nothing.


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