Search code examples
c++methodsroot-framework

C++, ROOT framework : member method called periodically


I have a class in my application displaying info.
I have to get those info from a server via SOAP.
Here's my class :

class InfoControl : public TGCompositeFrame {
private:
    //char*, int....
    bool bWorking;
public:
    InfoControl(const TGWindow *p);
    virtual ~InfoControl();
    void SetEventRate(char* evnum);
    void SetBufferRate(char* rate);
    void SetSuccess(char *s);
    void RequestInfo();
    ClassDef(InfoControl,1)  //useless : ROOT specific stuff
};

I would like RequestInfo() method to be called periodically as long as bWorking is true. I red about pthread solutions, but don't know how to implement this. And maybe something more trivial is possible ?

Thanks in advance for help,
eo.


Solution

  • Ok, found out. If someone has the same issue :

    TTimer *timer = new TTimer();  
    timer->Connect("Timeout()", "InfoControl", this, "RequestInfo()");  
    timer->Start(1000, kFALSE);