Changeset 11050


Ignore:
Timestamp:
06/17/11 09:54:02 (14 years ago)
Author:
tbretz
Message:
Added the comment (#) command and the LocalStream class
File:
1 edited

Legend:

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

    r11047 r11050  
    2626#include <boost/filesystem.hpp>
    2727
     28#include "tools.h"
     29
    2830#include "WindowLog.h"
    2931#include "StateMachineImp.h"
     
    4951    LocalControl(const char *name) : T(name),
    5052        fStateMachine(0), lout(T::GetStreamIn()),
    51         fName(boost::filesystem::path(name).filename().c_str())
     53        fName(boost::filesystem::path(name).filename())
    5254    { }
    5355
     
    5759        lout << " " << kUnderline << "Specific commands:" << endl;
    5860        lout << kBold << "   st,states    " << kReset << "Display a list of the available states with description." << endl;
     61        lout << kBold << "   # <text>     " << kReset << "Echo <text> to the output stream" << endl;
    5962        lout << kBold << "   .s           " << kReset << "Wait for the state-machine to change to the given state." << endl;
    6063        lout <<          "                "              "     .s <state> [<timeout>]" << endl;
     
    103106            }
    104107
    105             const Time timeout = Time()+boost::posix_time::millisec(ms);
     108            const Time timeout = ms<=0 ? Time(Time::none) : Time()+boost::posix_time::millisec(ms);
    106109
    107110            const int target = atoi(str.c_str()+3);
     
    112115        }
    113116
     117        if (str[0]=='#')
     118        {
     119            lout << Tools::Trim(str.substr(1)) << endl;
     120            return true;
     121        }
     122
    114123        if (T::Process(str))
    115124            return true;
     
    121130
    122131    void SetReceiver(StateMachineImp &imp) { fStateMachine = &imp; }
     132};
     133
     134// **************************************************************************
     135/** @class LocalStream
     136
     137@brief Derives the LocalControl from ConsoleStream
     138
     139This is basically a LocalControl, which derives through the template
     140argument from the ConsoleStream class.
     141
     142 */
     143// **************************************************************************
     144#include "Console.h"
     145
     146class LocalStream : public LocalControl<ConsoleStream>
     147{
     148public:
     149    LocalStream(const char *name, bool = false)
     150        : LocalControl<ConsoleStream>(name) { }
    123151};
    124152
     
    134162 */
    135163// **************************************************************************
    136 #include "Console.h"
    137164#include "tools.h"
    138165
Note: See TracChangeset for help on using the changeset viewer.