Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes
OCL::TaskBrowser Class Reference

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. More...

#include <TaskBrowser.hpp>

Inheritance diagram for OCL::TaskBrowser:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ColorTheme { nocolors, darkbg, whitebg }

Public Member Functions

void browserAction (std::string &act)
void evalCommand (std::string &comm)
void evaluate (std::string &comm)
void loop ()
 Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser.
void printHelp ()
void printHelp (std::string command)
void printInfo (const std::string &peerpath)
void printOperation (const std::string m, Service::shared_ptr ops)
void printProgram (const std::string &pn, int line=-1, RTT::TaskContext *progpeer=0)
void printProgram (int line=-1)
void printResult (RTT::base::DataSourceBase *ds, bool recurse)
bool printService (const std::string name)
void printSource (const std::string m)
void setColorTheme (ColorTheme t)
void switchBack ()
void switchTask (RTT::TaskContext *c)
void switchTaskContext (std::string &path)
void switchTaskContext (RTT::TaskContext *tc, bool store=true)
 TaskBrowser (RTT::TaskContext *c)
 ~TaskBrowser ()

Static Public Attributes

static std::string blue
static std::string coloroff
static std::string coloron
static std::string green
static std::string prompt
static std::string red
static std::string underline

Protected Member Functions

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

Protected Attributes

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

Private Types

typedef std::map< std::pair
< RTT::TaskContext
*, std::string >, int > 
PTrace

Static Private Member Functions

static RTT::TaskContextfindPeer (std::string comm)

Private Attributes

RTT::internal::DataSource
< bool >::shared_ptr 
accepted
int debug
const char * histfile
base::DataSourceBase::shared_ptr last_expr
int lastc
char * line_read
PTrace ptraces
int storedline
 last program listed to screen
std::string storedname
PTrace straces
std::deque< RTT::TaskContext * > taskHistory
bool usehex
 last program line number listed to screen

Static Private Attributes

static RTT::TaskContextcontext = 0
static RTT::TaskContextpeer = 0
static RTT::TaskContexttaskcontext = 0
static RTT::Service::shared_ptr taskobject
static RTT::TaskContexttb = 0

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 Typedef Documentation

typedef std::map<std::pair<RTT::TaskContext*,std::string>,int> OCL::TaskBrowser::PTrace [private]

Definition at line 112 of file TaskBrowser.hpp.


Member Enumeration Documentation

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.


Constructor & Destructor Documentation

Create a TaskBrowser which initially visits a given RTT::TaskContext c.

Definition at line 698 of file TaskBrowser.cpp.

Definition at line 745 of file TaskBrowser.cpp.


Member Function Documentation

void OCL::TaskBrowser::browserAction ( std::string &  act)

Execute a specific browser action, such as "loadProgram pname", "loadStateMachine smname", "unloadProgram pname", "unloadStateMachine smname"

Definition at line 1166 of file TaskBrowser.cpp.

void OCL::TaskBrowser::cancelMacro ( ) [protected]

Definition at line 974 of file TaskBrowser.cpp.

void OCL::TaskBrowser::checkPorts ( ) [protected]

Definition at line 1014 of file TaskBrowser.cpp.

void OCL::TaskBrowser::doPrint ( RTT::base::DataSourceBase::shared_ptr  ds,
bool  recurse 
) [protected]

Definition at line 1560 of file TaskBrowser.cpp.

void OCL::TaskBrowser::endMacro ( ) [protected]

Definition at line 984 of file TaskBrowser.cpp.

void OCL::TaskBrowser::enterTask ( ) [protected]

Definition at line 932 of file TaskBrowser.cpp.

void OCL::TaskBrowser::evalCommand ( std::string &  comm)

Evaluate command

Definition at line 1431 of file TaskBrowser.cpp.

void OCL::TaskBrowser::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.

RTT::TaskContext * OCL::TaskBrowser::findPeer ( std::string  comm) [static, private]

Definition at line 1143 of file TaskBrowser.cpp.

void OCL::TaskBrowser::leaveTask ( ) [protected]

Definition at line 942 of file TaskBrowser.cpp.

void OCL::TaskBrowser::listText ( std::stringstream &  txtss,
int  start,
int  end,
int  ln,
char  s 
) [protected]

Definition at line 1905 of file TaskBrowser.cpp.

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.

Print the help page.

Definition at line 1683 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printHelp ( std::string  command)

Print help about an operation

void OCL::TaskBrowser::printInfo ( const std::string &  peerpath)

Print info this peer or another peer at "peerpath".

Definition at line 1931 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printOperation ( const std::string  m,
Service::shared_ptr  ops 
)

Print the synopsis of an Operation

Definition at line 2140 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printProgram ( const std::string &  pn,
int  line = -1,
RTT::TaskContext progpeer = 0 
)

Print a program listing of a loaded program centered at line line.

Definition at line 1828 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printProgram ( int  line = -1)

Print the program listing of the last shown program centered at line line.

Definition at line 1871 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printResult ( RTT::base::DataSourceBase ds,
bool  recurse 
)

Evaluate a internal::DataSource and print the result.

Definition at line 1549 of file TaskBrowser.cpp.

bool OCL::TaskBrowser::printService ( const std::string  name)

Print the synopsis of a Service.

Definition at line 1401 of file TaskBrowser.cpp.

void OCL::TaskBrowser::printSource ( const std::string  m)

Print the synopsis of a DataSource.

void OCL::TaskBrowser::recordMacro ( std::string  name) [protected]

Definition at line 952 of file TaskBrowser.cpp.

Definition at line 1031 of file TaskBrowser.cpp.

Service::shared_ptr OCL::TaskBrowser::stringToService ( std::string const &  names) [protected]

Definition at line 1369 of file TaskBrowser.cpp.

Go to the previous peer in the visit history.

Definition at line 1004 of file TaskBrowser.cpp.

Switch to a new TaskContext.

void OCL::TaskBrowser::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.

void OCL::TaskBrowser::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.


Member Data Documentation

Definition at line 98 of file TaskBrowser.hpp.

string OCL::TaskBrowser::blue [static]

The blue color.

Definition at line 323 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::coloroff [static]

The 'turn color off' escape sequence.

Definition at line 308 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::coloron [static]

The 'turn color on' escape sequence.

Definition at line 300 of file TaskBrowser.hpp.

Definition at line 96 of file TaskBrowser.hpp.

int OCL::TaskBrowser::debug [private]

Definition at line 100 of file TaskBrowser.hpp.

string OCL::TaskBrowser::green [static]

The green color.

Definition at line 318 of file TaskBrowser.hpp.

const char* OCL::TaskBrowser::histfile [private]

Definition at line 117 of file TaskBrowser.hpp.

We store the last parsed expression in order to keep it a little longer in memory, for example, when it's an 'send()' operation call.

Definition at line 121 of file TaskBrowser.hpp.

int OCL::TaskBrowser::lastc [private]

Definition at line 103 of file TaskBrowser.hpp.

char* OCL::TaskBrowser::line_read [private]

Definition at line 102 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::macroname [protected]

Definition at line 173 of file TaskBrowser.hpp.

Definition at line 171 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::macrotext [protected]

Definition at line 172 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::peer = 0 [static, private]

Definition at line 92 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::prompt [static]

The prompt.

Definition at line 296 of file TaskBrowser.hpp.

Definition at line 113 of file TaskBrowser.hpp.

string OCL::TaskBrowser::red [static]

The red color.

Definition at line 313 of file TaskBrowser.hpp.

std::stringstream OCL::TaskBrowser::sresult [protected]

Definition at line 174 of file TaskBrowser.hpp.

last program listed to screen

Definition at line 106 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::storedname [private]

Definition at line 105 of file TaskBrowser.hpp.

Definition at line 114 of file TaskBrowser.hpp.

Definition at line 90 of file TaskBrowser.hpp.

Definition at line 109 of file TaskBrowser.hpp.

Definition at line 97 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::tb = 0 [static, private]

Definition at line 94 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::underline [static]

The 'underline' escape sequence.

Definition at line 304 of file TaskBrowser.hpp.

bool OCL::TaskBrowser::usehex [private]

last program line number listed to screen

Definition at line 107 of file TaskBrowser.hpp.


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


ocl
Author(s): OCL Development Team
autogenerated on Sat Jun 8 2019 18:48:55