Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

RWAlgo Class Reference

Base class for algorithms that reads and writes data. More...

#include <RW_algo.h>

Inheritance diagram for RWAlgo:

Inheritance graph
[legend]
Collaboration diagram for RWAlgo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Private Attributes

MAlmal

Detailed Description

Base class for algorithms that reads and writes data.

Derive from this class if you want to write an algorithm which modifies the data in some way. Changes made to the data via the MAl interface will be automatically reflected in the database, without the programmer having to worry about the DB.

The MAl and MAl_readonly functionality is provided by the getMAl() function.

SOP for creating a new RW algorithm (called NewAlgo in this example):

newalgo.h (include guards etc omitted):

     #include "RW_algo.h"

     class NewAlgo : public RWAlgo
     {
     public:
       NewAlgo(TrapperDoc * pDoc_, std::set< db_recno_t >& recnoList, AlgoParam* param) : 
       RWAlgo(pDoc_, recnoList, param) {}
     
       void start();
  
     };

That's it. The new algo implements the start() function and has to call RWAlgo'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 68 of file RW_algo.h.


Constructor & Destructor Documentation

RWAlgo::RWAlgo TrapperDoc pDoc_,
std::set< db_recno_t > &  recnoList,
AlgoParam param
 

Definition at line 3 of file RW_algo.cc.

00003                                                                                     : 
00004   Algo(pDoc_, recnoList, param), 
00005   mal( new MAl(2000, recnoList, pDoc_) ) 
00006 {
00007 
00008 }

RWAlgo::~RWAlgo  )  [inline]
 

Definition at line 72 of file RW_algo.h.

References mal.

00072 { delete mal; }


Member Function Documentation

MAl* RWAlgo::getMAl  )  [inline]
 

Definition at line 76 of file RW_algo.h.

References mal.

Referenced by TrashAlgo::check_qual_in_win(), DnpSortAlgo::init(), TrashAlgo::kill_read(), SortAlgo::old_start(), TrashRemoveAlgo::start(), TrashAlgo::start(), SubsetAlgo::start(), SortAlgo::start(), RemoveAlgo::start(), RealignerAlgo::start(), ReadnamesAlgo::start(), PrintAlgo::start(), DnpSortAlgo::start(), DnpAlgo::start(), ConsAlgo::start(), and TrashAlgo::trash().

00076 { return mal; }

virtual void RWAlgo::start  )  [pure virtual]
 

Implements Algo.

Implemented in ConsAlgo, DnpAlgo, DnpSortAlgo, PrintAlgo, ReadnamesAlgo, RealignerAlgo, RemoveAlgo, SortAlgo, SubsetAlgo, TrashAlgo, and TrashRemoveAlgo.


Member Data Documentation

MAl* RWAlgo::mal [private]
 

Definition at line 79 of file RW_algo.h.

Referenced by getMAl(), DnpAlgo::start(), ConsAlgo::start(), and ~RWAlgo().


The documentation for this class was generated from the following files:
Generated on Fri Mar 17 17:45:01 2006 for trapper by  doxygen 1.4.4