#ifndef FACT_LocalControl #define FACT_LocalControl #include // ************************************************************************** /** @class LocalControl @brief Implements a local control for a StateMachine based on a Readline class This template implements all functions which overwrite any function from the Readline class needed for a local control of a state machien. Since several derivatives of the Readline class implement different kind of Readline access, this class can be derived by any of them due to its template argument. However, the normal case will be deriving it from either Console or Shell. @tparam T The base class for RemoteControl. Either Readlien or a class deriving from it. This is usually either Console or Shell. **/ // ************************************************************************** #include #include #include "tools.h" #include "WindowLog.h" #include "StateMachineImp.h" using namespace std; template class LocalControl : public T { private: char **Completion(const char *text, int pos, int) { return pos>0 ? 0 : T::Complete(fStateMachine->GetEventNames(), text); } protected: StateMachineImp *fStateMachine; std::ostream &lout; std::string fName; LocalControl(const char *name) : T(name), fStateMachine(0), lout(T::GetStreamIn()), #if BOOST_VERSION < 104600 fName(boost::filesystem::path(name).filename()) #else fName(boost::filesystem::path(name).filename().string()) #endif { } bool PrintGeneralHelp() { T::PrintGeneralHelp(); lout << " " << kUnderline << "Specific commands:" << endl; lout << kBold << " ac,allowed " << kReset << "Display a list of all currently allowed commands." << endl; lout << kBold << " st,states " << kReset << "Display a list of the available states with description." << endl; lout << kBold << " > " << kReset << "Echo to the output stream" << endl; lout << kBold << " .s " << kReset << "Wait for the state-machine to change to the given state.\n"; lout << " " " .s [ [ [