OrocosComponentLibrary  2.8.3
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
TaskBrowser Class Reference

This component allows a text client to browse the peers of a peer RTT::TaskContext and execute commands. More...

#include <TaskBrowser.hpp>

Inheritance diagram for TaskBrowser:

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 Member Functions

void listText (std::stringstream &txtss, int start, int end, int ln, char s)
 
void doPrint (RTT::base::DataSourceBase::shared_ptr ds, bool recurse)
 
void enterTask ()
 
void leaveTask ()
 
void recordMacro (std::string name)
 
void cancelMacro ()
 
void endMacro ()
 
void checkPorts ()
 
Service::shared_ptr stringToService (std::string const &names)
 

Protected Attributes

bool macrorecording
 
std::string macrotext
 
std::string macroname
 
std::stringstream sresult
 

Detailed Description

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.

Member Enumeration Documentation

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.

Member Function Documentation

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 ( )
void switchTaskContext ( std::string &  path)

Switch to a peer RTT::TaskContext using a path .

For example, "mypeer.otherpeer.targetpeer".

Parameters
pathThe 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.

Parameters
tcthe new Task to connect to
storeset to true in order to store the current task in the history.

Definition at line 1100 of file TaskBrowser.cpp.


The documentation for this class was generated from the following files: