#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.
|
Definition at line 3 of file R_algo.cc. 00003 : 00004 Algo(pDoc_, recnoList, param), 00005 mal( new MAl_Readonly(2000, recnoList, pDoc_) ) 00006 { 00007 00008 }
|
|
Definition at line 70 of file R_algo.h. References mal. 00070 { delete mal; }
|
|
Definition at line 74 of file R_algo.h. References mal. Referenced by StrandsAlgo::start(), ReadListAlgo::start(), DnpSearchAlgo::start(), and AceWriter::write_ace_file(). 00074 { return mal; }
|
|
Implements Algo. Implemented in AceWriter, DnpSearchAlgo, ReadListAlgo, and StrandsAlgo. |
|
|