Changeset 10273


Ignore:
Timestamp:
Mar 30, 2011, 3:55:03 PM (10 years ago)
Author:
tbretz
Message:
Adapted to new interface of Converter class, added the possibility to run a dummy loop.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineImp.cc

    r10218 r10273  
    233233    lout << kBlue << name;
    234234
     235    const Converter conv(lout, fmt, false);
     236
     237    const vector<char> v = conv.GetVector(str.substr(p0));
     238    if (!conv.valid() || v.empty()!=conv.empty())
     239    {
     240        lout << kRed << "Couldn't properly parse the input... ignored." << endl;
     241        return false;
     242    }
     243
     244    return PostEvent(*evt, v.data(), v.size());
     245/*
    235246    const Converter c(lout, fmt, str.substr(p0));
    236247
     
    243254
    244255    return PostEvent(*evt, c.Ptr(), c.Size());
     256    */
    245257}
    246258
     
    470482    evt->AddAllowedStates(states);
    471483
    472     Out() << ":   " << Time().GetAsStr() << ": Adding command " << evt->GetName();
     484    Out() << ":   " << Time().GetAsStr() << " - Adding command " << evt->GetName();
    473485    Out() << " (transition to " << GetStateDescription(evt->GetTargetState()) << ")" << endl;
    474486
     
    912924//!   \enddot
    913925//!
     926//! @param dummy
     927//!    If this parameter is set to treu then no action is executed
     928//!    and now events are dispatched from the event list. It is usefull
     929//!    if functions are assigned directly to any event to simulate
     930//!    a running loop (e.g. block until Stop() was called or fExitRequested
     931//!    was set by an EXIT command.
     932//!
    914933//! @returns
    915934//!    In the case of a a fatal error -1 is returned, fExitRequested-1 in all
     
    919938//! @todo  Fix docu (kSM_SetReady, HandleEvent)
    920939//
    921 int StateMachineImp::Run()
     940int StateMachineImp::Run(bool dummy)
    922941{
    923942    if (fCurrentState>=kSM_Ready)
     
    935954    {
    936955        usleep(1);
     956        if (dummy)
     957            continue;
    937958
    938959        // Execute a step in the current state of the state machine
  • trunk/FACT++/src/StateMachineImp.h

    r10218 r10273  
    9393
    9494    /// Start the mainloop
    95     int Run();
     95    int Run(bool dummy=false);
    9696
    9797    /// Request to stop the mainloop
Note: See TracChangeset for help on using the changeset viewer.