$search

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 (std::string command)
void printHelp ()
void printInfo (const std::string &peerpath)
void printOperation (const std::string m, Service::shared_ptr ops)
void printProgram (int line=-1)
void printProgram (const std::string &pn, int line=-1, RTT::TaskContext *progpeer=0)
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 (RTT::TaskContext *tc, bool store=true)
void switchTaskContext (std::string &path)
 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
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 176 of file TaskBrowser.hpp.


Constructor & Destructor Documentation

OCL::TaskBrowser::TaskBrowser ( RTT::TaskContext c  ) 

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

Definition at line 577 of file TaskBrowser.cpp.

OCL::TaskBrowser::~TaskBrowser (  ) 

Definition at line 612 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 1038 of file TaskBrowser.cpp.

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

Definition at line 845 of file TaskBrowser.cpp.

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

Definition at line 885 of file TaskBrowser.cpp.

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

Definition at line 855 of file TaskBrowser.cpp.

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

Definition at line 803 of file TaskBrowser.cpp.

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

Evaluate command

Definition at line 1303 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 1237 of file TaskBrowser.cpp.

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

Definition at line 1014 of file TaskBrowser.cpp.

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

Definition at line 813 of file TaskBrowser.cpp.

void OCL::TaskBrowser::listText ( std::stringstream &  txtss,
int  start,
int  end,
int  ln,
char  s 
) [protected]
void OCL::TaskBrowser::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 667 of file TaskBrowser.cpp.

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

Print help about an operation

void OCL::TaskBrowser::printHelp (  ) 

Print the help page.

Definition at line 1555 of file TaskBrowser.cpp.

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

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

Definition at line 1803 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 2011 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 1743 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 1700 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 1421 of file TaskBrowser.cpp.

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

Print the synopsis of a Service.

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 823 of file TaskBrowser.cpp.

void OCL::TaskBrowser::setColorTheme ( ColorTheme  t  ) 

Definition at line 902 of file TaskBrowser.cpp.

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

Go to the previous peer in the visit history.

Definition at line 875 of file TaskBrowser.cpp.

void OCL::TaskBrowser::switchTask ( RTT::TaskContext c  ) 

Switch to a new TaskContext.

void OCL::TaskBrowser::switchTaskContext ( RTT::TaskContext tc,
bool  store = true 
)

Connect the TaskBrowser to another Taskcontext.

Parameters:
tc the new Task to connect to
store set to true in order to store the current task in the history.

Definition at line 971 of file TaskBrowser.cpp.

void OCL::TaskBrowser::switchTaskContext ( std::string &  path  ) 

Switch to a peer RTT::TaskContext using a path . For example, "mypeer.otherpeer.targetpeer".

Parameters:
path The path to the target peer.

Definition at line 949 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 313 of file TaskBrowser.hpp.

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

The 'turn color off' escape sequence.

Definition at line 298 of file TaskBrowser.hpp.

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

The 'turn color on' escape sequence.

Definition at line 290 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 308 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 118 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 163 of file TaskBrowser.hpp.

Definition at line 161 of file TaskBrowser.hpp.

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

Definition at line 162 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 286 of file TaskBrowser.hpp.

Definition at line 113 of file TaskBrowser.hpp.

string OCL::TaskBrowser::red [static]

The red color.

Definition at line 303 of file TaskBrowser.hpp.

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

Definition at line 164 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 294 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


ocl
Author(s): OCL Development Team
autogenerated on Fri Mar 1 16:28:36 2013