OrocosComponentLibrary
2.8.3
|
This component allows a text client to browse the peers of a peer RTT::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 RTT::TaskContext using a path . More... | |
void | switchTaskContext (RTT::TaskContext *tc, bool store=true) |
Connect the TaskBrowser to another Taskcontext. More... | |
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::base::DataSourceBase *ds, bool recurse) |
Evaluate a internal::DataSource and print the result. | |
void | printHelp () |
Print the help page. | |
void | printHelp (std::string command) |
Print help about an operation. | |
void | printInfo (const std::string &peerpath) |
Print info this peer or another peer at "peerpath". | |
void | printSource (const std::string m) |
Print the synopsis of a DataSource. | |
void | printOperation (const std::string m, Service::shared_ptr ops) |
Print the synopsis of an Operation. | |
bool | printService (const std::string name) |
Print the synopsis of a Service. | |
void | printProgram (const std::string &pn, int line=-1, RTT::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 RTT::TaskContext c. | |
void | loop () |
Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser. More... | |
void | evaluate (std::string &comm) |
Execute/evaluate a string which may be a command, method, expression etc. More... | |
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 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 RTT::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 86 of file TaskBrowser.hpp.
enum ColorTheme |
The kinds of color themes the TaskBrowser supports.
Enumerator | |
---|---|
nocolors |
Do not use colors. |
darkbg |
Use colors suitable for a dark background. |
whitebg |
Use colors suitable for a white background. |
Definition at line 186 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 1365 of file TaskBrowser.cpp.
References TaskBrowser::evalCommand().
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 802 of file TaskBrowser.cpp.
References TaskBrowser::browserAction(), TaskBrowser::coloroff, TaskBrowser::coloron, TaskBrowser::evalCommand(), OCL::getTaskStatusChar(), TaskBrowser::green, TaskBrowser::printHelp(), TaskBrowser::printInfo(), TaskBrowser::printProgram(), TaskBrowser::prompt, TaskBrowser::switchBack(), TaskBrowser::switchTaskContext(), and TaskBrowser::underline.
Referenced by HelloWorld::HelloWorld().
void switchTaskContext | ( | std::string & | path | ) |
Switch to a peer RTT::TaskContext using a path .
For example, "mypeer.otherpeer.targetpeer".
path | The path to the target peer. |
Definition at line 1078 of file TaskBrowser.cpp.
Referenced by TaskBrowser::loop(), TaskBrowser::switchBack(), and TaskBrowser::TaskBrowser().
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. |
Definition at line 1100 of file TaskBrowser.cpp.