RAlgo Class Reference

Base class for algorithms that reads data. Nota bene! Read-only! More...

#include <R_algo.h>

Inheritance diagram for RAlgo:

Inheritance graph
[legend]
Collaboration diagram for RAlgo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RAlgo (TrapperDoc *pDoc_, std::set< db_recno_t > &recnoList, AlgoParam *param)
 ~RAlgo ()
virtual void start ()=0
MAl_ReadonlygetMAl ()

Private Attributes

MAl_Readonlymal

Detailed Description

Base class for algorithms that reads data. Nota bene! Read-only!

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.


Constructor & Destructor Documentation

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]

Definition at line 70 of file R_algo.h.

References mal.

00070 { delete mal; }


Member Function Documentation

virtual void RAlgo::start (  )  [pure virtual]

Implements Algo.

Implemented in StrandsAlgo.

MAl_Readonly* RAlgo::getMAl (  )  [inline]

Definition at line 74 of file R_algo.h.

References mal.

Referenced by StrandsAlgo::start().

00074 { return mal; }


Member Data Documentation

MAl_Readonly* RAlgo::mal [private]

Definition at line 77 of file R_algo.h.

Referenced by getMAl(), and ~RAlgo().


The documentation for this class was generated from the following files:
Generated on Fri Jul 17 20:19:51 2009 for ngsview by  doxygen 1.5.1