Changeset 14554 for trunk


Ignore:
Timestamp:
11/03/12 19:18:21 (12 years ago)
Author:
tbretz
Message:
Some improvements for the output during a script is running; added a callback for each state change.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/RemoteControl.h

    r14546 r14554  
    2323{
    2424protected:
     25    std::ostream &lin;           /// Output stream for local synchrounous output
    2526    std::ostream &lout;          /// Output stream for local synchrounous output
    2627
     
    2930protected:
    3031    // Redirect asynchronous output to the output window
    31     RemoteControlImp(std::ostream &, std::ostream &in) : lout(in)
     32    RemoteControlImp(std::ostream &out, std::ostream &in) : lin(out), lout(in)
    3233    {
    3334    }
     
    165166    virtual void  JsEnd(const std::string &)          { UnsubscribeAll(); SetSection(-3); }
    166167    virtual bool  JsSend(const std::string &str)      { return ProcessCommand(str); }
    167     virtual void  JsOut(const std::string &msg)       { lout << msg << endl; }
     168    virtual void  JsOut(const std::string &msg)       { lin << msg << endl; }
    168169    virtual void  JsPrint(const std::string &msg)     { if (fImp) fImp->Comment(msg.empty()?" ":msg); }
    169170    virtual void  JsAlarm(const std::string &msg)     { if (fImp) fImp->Alarm(msg.empty()?" ":msg); }
     
    413414
    414415            T::fScript = opt;
     416
     417            T::Lock();
    415418            JsRun(opt, data);
     419            T::Unlock();
     420
    416421            return true;
    417422        }
     
    431436            }
    432437
     438            T::Lock();
    433439            const int rc = JsWait(server, state, ms);
     440            T::Unlock();
    434441
    435442            if (rc<0 || rc==1)
     
    476483    }
    477484
    478     void SetReceiver(StateMachineDimControl &imp) { fImp = &imp; }
     485    void SetReceiver(StateMachineDimControl &imp)
     486    {
     487        fImp = &imp;
     488        fImp->SetStateCallback(bind(&InterpreterV8::JsHandleState, this, placeholders::_1, placeholders::_2));
     489    }
    479490};
    480491
Note: See TracChangeset for help on using the changeset viewer.