Functors are C++ equivalents of function pointers in C. However, functors
can also maintain state, be copied, created and destroyed. For details,
please see the OEChem C++ theory manual. All of the functors here are derived
from template<class Arg> class OESystem::OEUnaryPredicate
or
template<class Arg1,class Arg2> class OESystem::OEBinaryPredicate
.
All of the functors will have a virtual bool operator() const
function
which takes an argument of type const Arg&, where Arg is the their template
argument. Many of the functors also have a constructor which generates the
state critical to the evaluation of their operator().
All functors also contain three other functions which will be covered once here and not duplicated in each section.
OESystem::OEUnaryFunction<class Arg,bool> *CreateCopy() const
CreateCopy is a virtual constructor. It returns a copy of the functor itself with its correct internal state. This function allows a user to copy functors even if they only have a pointer or reference to the base class.