On Tuesday 15 January 2002 6:37 pm, Angus Leeming wrote:
> Here's a second question. Many of the other controllers (15 in fact) are 
> derived from ControlDialog, so again I'll split ControlDialog.h into 
> ControlDialog.h and ControlDialog.tmpl
> 
> However, there are only two instatiations of ControlDialog:
> ControlDialog<ControlConnectBD> 
> ControlDialog<ControlConnectBI>
> 
> is there a way therefore of changing something in ControlDialog.tmpl that 
> results in only two recompiles? Ie, rather than #include 
"ControlDialog.tmpl" 
> in all 15 files of the derived classes, I'd like to create
> ControlDialog<ControlConnectBD> and ControlDialog<ControlConnectBI>
> 
> Can this be done? If so, how?

answering my own question:

file "ControlDialogImpl.h"
class ControlConnectBD;
class ControlConnectBI;

struct ControlDialogBD : public ControlDialog<ControlConnectBD> 
{
        ControlDialogBD();
};
struct ControlDialogBI : public ControlDialog<ControlConnectBD>
{
        ControlDialogBI();
};

file "ControlDialogImpl.C"
#include "ControlDialogImpl.h"
#include "ControlDialog.tmpl"

ControlDialogBD::ControlDialogBD()
        : ControlDialog<ControlConnectBD>
{}

ControlDialogBI::ControlDialogBI()
        : ControlDialog<ControlConnectBD>
{}

Derive the 15 classes from ControlDialogBD and ControlConnectBI. These, 
therefore need #include that .h file. 
Create the two instatiations by compiling the ControlDialogImpl.C file.

Bingo!

But are you happy with this?
Angus

Reply via email to