This component allows a text client to browse the peers of a peer TaskContext and execute commands. More...
#include <TaskBrowser.hpp>
Public Types | |
enum | ColorTheme { nocolors, darkbg, whitebg } |
The kinds of color themes the TaskBrowser supports. More... | |
Public Member Functions | |
void | setColorTheme (ColorTheme t) |
void | switchTaskContext (std::string &path) |
Switch to a peer TaskContext using a path . | |
void | switchTaskContext (RTT::TaskContext *tc, bool store=true) |
Connect the TaskBrowser to another Taskcontext. | |
void | switchBack () |
Go to the previous peer in the visit history. | |
void | browserAction (std::string &act) |
Execute a specific browser action, such as "loadProgram pname", "loadStateMachine smname", "unloadProgram pname", "unloadStateMachine smname". | |
void | printResult (RTT::DataSourceBase *ds, bool recurse) |
Evaluate a DataSource and print the result. | |
void | printHelp () |
Print the help page. | |
void | printInfo (const std::string &peerpath) |
Print info this peer or another peer at "peerpath". | |
void | printCommand (const std::string c, OperationInterface *ops) |
Print the synopsis of a command. | |
void | printSource (const std::string m) |
Print the synopsis of a DataSource. | |
void | printMethod (const std::string m, OperationInterface *ops) |
Print the synopsis of a Method. | |
void | printEvent (const std::string m, RTT::EventService *ops) |
Print the synopsis of an Event. | |
void | printProgram (const std::string &pn, int line=-1, TaskContext *progpeer=0) |
Print a program listing of a loaded program centered at line line. | |
void | printProgram (int line=-1) |
Print the program listing of the last shown program centered at line line. | |
TaskBrowser (RTT::TaskContext *c) | |
Create a TaskBrowser which initially visits a given TaskContext c. | |
void | loop () |
Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser. | |
void | evaluate (std::string &comm) |
Execute/evaluate a string which may be a command, method, expression etc. | |
void | switchTask (RTT::TaskContext *c) |
Switch to a new TaskContext. | |
void | evalCommand (std::string &comm) |
Evaluate command. | |
Static Public Attributes | |
static std::string | prompt |
The prompt. | |
static std::string | coloron |
The 'turn color on' escape sequence. | |
static std::string | underline |
The 'underline' escape sequence. | |
static std::string | coloroff |
The 'turn color off' escape sequence. | |
static std::string | red |
The red color. | |
static std::string | green |
The green color. | |
static std::string | blue |
The blue color. | |
Protected Member Functions | |
void | listText (std::stringstream &txtss, int start, int end, int ln, char s) |
void | doPrint (RTT::DataSourceBase *ds, bool recurse) |
void | enterTask () |
void | leaveTask () |
void | recordMacro (std::string name) |
void | cancelMacro () |
void | endMacro () |
void | checkPorts () |
Protected Attributes | |
bool | macrorecording |
std::string | macrotext |
std::string | macroname |
std::stringstream | sresult |
This component allows a text client to browse the peers of a peer TaskContext and execute commands.
If your console does not support colors or you want a different prompt, the member variables which control these 'escape sequences' are public and may be changed. The TaskBrowser is most commonly used with its loop() method, but prior to/after calling loop(), you can invoke some other commands, to control what is displayed or to execute a fixed set of commands prior to showng the prompt.
Definition at line 84 of file TaskBrowser.hpp.
enum ColorTheme |
The kinds of color themes the TaskBrowser supports.
nocolors |
Do not use colors. |
darkbg |
Use colors suitable for a dark background. |
whitebg |
Use colors suitable for a white background. |
Definition at line 167 of file TaskBrowser.hpp.
void evaluate | ( | std::string & | comm | ) |
Execute/evaluate a string which may be a command, method, expression etc.
The string does not need the script prefixes such as 'do', 'set', etc. For example "x = 1 + 1" or "myobject.doStuff(1, 2, true)".
Definition at line 1153 of file TaskBrowser.cpp.
void loop | ( | ) |
Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser.
Call this method from ORO_main() to process keyboard input.
Definition at line 585 of file TaskBrowser.cpp.
void switchTaskContext | ( | RTT::TaskContext * | tc, | |
bool | store = true | |||
) |
Connect the TaskBrowser to another Taskcontext.
tc | the new Task to connect to | |
store | set to true in order to store the current task in the history. |
void switchTaskContext | ( | std::string & | path | ) |
Switch to a peer TaskContext using a path .
For example, "mypeer.otherpeer.targetpeer".
path | The path to the target peer. |
Definition at line 870 of file TaskBrowser.cpp.
References TaskBrowser::blue, TaskBrowser::coloron, TaskBrowser::darkbg, TaskBrowser::green, TaskBrowser::nocolors, TaskBrowser::red, TaskBrowser::underline, and TaskBrowser::whitebg.