I have a couple C++ programming questions and I would appreciate some help.
I am deriving a class “SpecialRFPulses” from another class “sRF_PULSE_ARB” and I would like to write a wrapper function “prep_DK( ----)” around the inherited member function “prepArbitrary(---)”. I have no idea how to do it.
This is what I am trying (obviously call of prepArbitrary is wrong):
extern MrProtocolData::MrProtData* pOrigProt;
extern MrProtocolData::SeqExpo &rSeqExpo;
class SpecialRFPulses: public sRF_PULSE_ARB
{
public:
SpecialRFPulses(long lDuration_In)
{
lDuration = lDuration_In; //in us
}
~SpecialRFPulses(){
}
bool prep_DK (MrProtocolData::MrProtData &, MrProtocolData::SeqExpo &);
protected:
private:
long lDuration; // in us
long lStartTime_in_us; // in us
};
bool SpecialRFPulses::prep_DK (MrProtocolData::MrProtData &rMrProt, MrProtocolData::SeqExpo &rSeqExpo)
{
NLS_STATUS lStatus;
// create myRFPulseArray and calculate dEffectiveAmplIntegral
// HERE I WOULD HAVE LIKED TO USE prepArbitrary
// Of course, this current syntax is WRONG.
if (!myRFPulse.prepArbitrary(pOrigProt, &rSeqExpo, myRFPulseArray, dEffectiveAmplIntegral))
{
std::cout << "ERROR: "<<myRFPulse.getNLSStatus()<<std::endl;
return (false);
};
return true;
}
Also, unlike other functions which usually takes reference to class MrProtData and SeqExpo, prepArbitrary defined in third party library takes pointer.
My questions are:
1) How to write a wrapper function around inherited function: prepArbitrary?
2) Rather than defining "pOrigProt" and "rSeqExpo" as extern, can I pass it as an argument to constructor of the derived class and then use this in wrapper function"prepDK(---)?
Any help would be very appreciated.
Regards, Dushyant