Added a bit more documentation, more to follow (I hope)
This commit is contained in:
parent
262869d0ae
commit
07bc61e694
1 changed files with 18 additions and 5 deletions
|
|
@ -28,8 +28,21 @@
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
/// Base class for functors to get a nice hierarchy diagram
|
/** Base class for functors to get a nice hierarchy diagram
|
||||||
class eoFunctorBase
|
|
||||||
|
That's actually quite an understatement as it does quite a bit more than
|
||||||
|
just that. By having all functors derive from the same base class, we can
|
||||||
|
do some memory management that would otherwise be very hard.
|
||||||
|
|
||||||
|
The memory management base class is called eoFunctorStore, and it supports
|
||||||
|
a member add() to add a pointer to a functor. When the functorStore is
|
||||||
|
destroyed, it will delete all those pointers. So beware: do not delete
|
||||||
|
the functorStore before you are done with anything that might have been allocated.
|
||||||
|
|
||||||
|
@see eoFunctorStore
|
||||||
|
|
||||||
|
*/
|
||||||
|
class eoFunctorBase
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
virtual ~eoFunctorBase() {}
|
virtual ~eoFunctorBase() {}
|
||||||
|
|
@ -42,7 +55,7 @@ public :
|
||||||
struct binary_function_tag {};
|
struct binary_function_tag {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Basic Function. Derive from this class when defining
|
Basic Function. Derive from this class when defining
|
||||||
any procedure. It defines a result_type that can be used
|
any procedure. It defines a result_type that can be used
|
||||||
to determine the return type
|
to determine the return type
|
||||||
|
|
@ -53,12 +66,12 @@ template <class R>
|
||||||
class eoF : public eoFunctorBase
|
class eoF : public eoFunctorBase
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
/// virtual dtor here so there is no need to define it in derived classes
|
/// virtual dtor here so there is no need to define it in derived classes
|
||||||
virtual ~eoF() {}
|
virtual ~eoF() {}
|
||||||
|
|
||||||
typedef R result_type;
|
typedef R result_type;
|
||||||
|
|
||||||
/// The pure virtual function that needs to be implemented by the subclass
|
/// The pure virtual function that needs to be implemented by the subclass
|
||||||
virtual R operator()() = 0;
|
virtual R operator()() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue