function pointer problem

A

alessio211734

I have a singleton class Modem

namespace Proxy
{

Modem
{
....
static Modem* Instance();

Intf::ModemAlarmStatusRespMsg *GetAlarmStatusRespMsg(){return
&m_alarmStatusResp;}

....

}

};

class BaseModemAlarm:public BaseAlarm
{

public:

BaseModemAlarm(){};
BaseModemAlarm(const ut_int32 AlarmId){};

Intf::ModemOffOnEnum (*funcField)();

private:
//MemFunc funcField;

ut_int32 AlarmId;
// method
int GetRefValue(){return static_cast<int> (Intf::MOD_ON);};
int GetStatusValue(){ return static_cast<int> ( (*funcField)
() ); };
};


// in constructor of another class I would like build a instance of
BaseModemAlarm passing
a member function.

ModemAlarmHandler::ModemAlarmHandler()
{
BaseModemAlarm Alarm_OlBitePll(Intf::MODEM_OL_BITE_PLL_ALARM);
Intf::ModemAlarmStatusRespMsg * msg=Proxy::Modem::Instance-
GetAlarmStatusRespMsg();
Alarm_OlBitePll.funcField=&(msg->GetOlBitePllAlarm);

};

I would like access to msg->GetOlBitePllAlarm() at runtime from
Alarm_OlBitePll instance.
I get a compiler error. I can't access directly to
ModemAlarmStatusRespMsg fields beacuse they are declare as private and
I can't modify the class definition.

I need to declare several different instance of BaseModemAlarm and for
every instance I should call a different method for msg object.
Please help me.



Ale.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,965
Members
47,513
Latest member
JeremyLabo

Latest Threads

Top