#include <R_algo.h>
Inheritance diagram for RAlgo:
Public Member Functions | |
RAlgo (TrapperDoc *pDoc_, std::set< db_recno_t > &recnoList, AlgoParam *param) | |
~RAlgo () | |
virtual void | start ()=0 |
MAl_Readonly * | getMAl () |
Private Attributes | |
MAl_Readonly * | mal |
Derive from this class if you want to write an algorithm which only need read access to the data.
The MAl_readonly functionality is provided by the getMAl() function.
SOP for creating a new R algorithm (called NewAlgo in this example):
newalgo.h (include guards etc omitted):
#include "R_algo.h" class NewAlgo : public RAlgo { public: NewAlgo(TrapperDoc * pDoc_, std::set< db_recno_t >& recnoList, AlgoParam* param) : RAlgo(pDoc_, recnoList, param) {} void start(); };
That's it. The new algo implements the start() function and has to call RAlgo's only constructor. start() can be virtual if a family of algos are being constructed.
NOTA BENE! Important that the constructor gets a reference to the recnolist!
newalgo.cpp:
#include "newalgo.h" void NewAlgo::start() { //implementation of NewAlgo::start(). }
newalgomaker.cpp:
#include "algomaker.h" #include "newalgo.h" char newAlgo[]="New Algo";//The text that shows up in the popup const bool newPopsup = true;//true if it should pop up in context menu template const AlgoMakerTP< NewAlgo, newAlgo, newPopsup > AlgoMakerTP< NewAlgo, newAlgo, newPopsup >::registerThis;
Add the new files to src.pro and you're done.
Definition at line 66 of file R_algo.h.
RAlgo::RAlgo | ( | TrapperDoc * | pDoc_, | |
std::set< db_recno_t > & | recnoList, | |||
AlgoParam * | param | |||
) |
Definition at line 3 of file R_algo.cc.
00003 : 00004 Algo(pDoc_, recnoList, param), 00005 mal( new MAl_Readonly(10000, recnoList, pDoc_) ) 00006 { 00007 00008 }
RAlgo::~RAlgo | ( | ) | [inline] |
virtual void RAlgo::start | ( | ) | [pure virtual] |
MAl_Readonly* RAlgo::getMAl | ( | ) | [inline] |
Definition at line 74 of file R_algo.h.
References mal.
Referenced by StrandsAlgo::start().
00074 { return mal; }
MAl_Readonly* RAlgo::mal [private] |