Go to the documentation of this file.00001
00002
00003
00004
00005
00008
00009 #ifndef lgrConsole_H_
00010 #define lgrConsole_H_
00011
00012 #include "lgrCore.h"
00013 #include <vlutil/vlRunnable.h>
00014 #include <vlutil/vlString.h>
00015 #include <vlutil/vlSmartPointers.h>
00016
00017 #include <list>
00018
00019 namespace MAKLogger
00020 {
00021
00022 class DtLgrFullInterface;
00023 class DtLogger;
00024
00027 class DT_DLL_LGRCORE DtLgrConsole : public DtRunnable
00028 {
00029 public:
00030
00031 static void allocateConsole();
00032 static void deallocateConsole();
00033
00034 DtLgrConsole(DtLogger&);
00035 virtual ~DtLgrConsole();
00036
00037 virtual void stop();
00038 virtual void run();
00039
00040 virtual void setInputHistorySize(int size);
00041 virtual int inputHistorySize() const;
00042
00043 static void shutdown();
00044
00045 protected:
00046
00048 virtual void printMessage(const DtString& message);
00049
00051 virtual void printFileDoesNotExistMessage(const DtString& filename);
00052
00054 virtual void printFileInvalidMessage(const DtString& filename);
00055
00057 virtual void printInput(const DtString& input);
00058
00060 virtual void clearInput();
00061
00063 static DtString dequote(const DtString& input);
00064
00067
00069 bool nonBlockingGetLine(DtString& input,bool& changed);
00070
00072 virtual void processInput(const DtString& input);
00073
00076 virtual void addInputToHistory(const DtString& input);
00077
00079 virtual DtString getPreviousInput();
00080
00082 virtual DtString getNextInput();
00083
00084 void sendShutdown();
00085
00086 volatile bool myRunningFlag;
00087 DtString myCurrentInput;
00088 int myMaxInputHistorySize;
00089
00090 typedef std::list<DtString> StringList;
00091
00092 StringList myInputHistory;
00093 StringList::iterator myCurrentHistoryInput;
00094 DtLgrFullInterface* myInterface;
00095
00096 static volatile bool myHasConsole;
00097
00098 static volatile DtLgrConsole* theConsole;
00099 };
00100
00101 typedef DtBoost::shared_ptr<DtLgrConsole> DtLgrConsoleSP;
00102
00103 }
00104
00105 #endif