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>
Public Types | |
enum | ColorTheme { nocolors, darkbg, whitebg } |
Public Types inherited from RTT::TaskContext | |
typedef std::vector< std::string > | PeerList |
typedef boost::function< void(base::PortInterface *)> | SlotFunction |
Public Types inherited from RTT::base::TaskCore | |
enum | TaskState |
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. More... | |
bool | printGlobals () |
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 () | |
Public Member Functions inherited from RTT::TaskContext | |
bool | addAttribute (const std::string &name, T &attr) |
bool | addAttribute (base::AttributeBase &a) |
bool | addAttribute (base::AttributeBase &a) |
bool | addAttribute (const std::string &name, T &attr) |
bool | addConstant (const std::string &name, const T &attr) |
bool | addConstant (const std::string &name, const T &attr) |
base::InputPortInterface & | addEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
base::InputPortInterface & | addEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
Operation< Signature > & | addOperation (Operation< Signature > &op) |
Operation< Signature > & | addOperation (Operation< Signature > &op) |
Operation< typename internal::GetSignature< Func >::Signature > & | addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread) |
Operation< Signature > & | addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread) |
Operation< typename internal::GetSignature< Func >::Signature > & | addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread) |
Operation< Signature > & | addOperation (const std::string name, Signature *func, ExecutionThread et=ClientThread) |
virtual bool | addPeer (TaskContext *peer, std::string alias="") |
virtual bool | addPeer (TaskContext *peer, std::string alias="") |
base::PortInterface & | addPort (const std::string &name, base::PortInterface &port) |
base::PortInterface & | addPort (base::PortInterface &port) |
Property< T > & | addProperty (const std::string &name, T &attr) |
bool | addProperty (base::PropertyBase &pb) |
Property< T > & | addProperty (const std::string &name, T &attr) |
bool | addProperty (base::PropertyBase &pb) |
ConfigurationInterface * | attributes () |
ConfigurationInterface * | attributes () |
virtual void | clear () |
virtual bool | connectPeers (TaskContext *peer) |
virtual bool | connectPeers (TaskContext *peer) |
virtual bool | connectPorts (TaskContext *peer) |
virtual bool | connectServices (TaskContext *peer) |
virtual bool | connectServices (TaskContext *peer) |
virtual void | disconnect () |
virtual void | disconnect () |
virtual void | disconnectPeers (const std::string &name) |
virtual void | disconnectPeers (const std::string &name) |
base::ActivityInterface * | getActivity () |
T * | getActivity () |
base::AttributeBase * | getAttribute (const std::string &name) const |
base::AttributeBase * | getAttribute (const std::string &name) const |
virtual const std::string & | getName () const |
OperationInterfacePart * | getOperation (std::string name) |
OperationInterfacePart * | getOperation (std::string name) |
virtual TaskContext * | getPeer (const std::string &peer_name) const |
virtual TaskContext * | getPeer (const std::string &peer_name) const |
virtual PeerList | getPeerList () const |
virtual PeerList | getPeerList () const |
base::PortInterface * | getPort (const std::string &name) const |
base::PropertyBase * | getProperty (const std::string &name) const |
base::PropertyBase * | getProperty (const std::string &name) const |
boost::shared_ptr< ServiceType > | getProvider (const std::string &name) |
boost::shared_ptr< ServiceType > | getProvider (const std::string &name) |
virtual bool | hasPeer (const std::string &peer_name) const |
virtual bool | hasPeer (const std::string &peer_name) const |
bool | loadService (const std::string &service_name) |
bool | loadService (const std::string &service_name) |
OperationInterface * | operations () |
OperationInterface * | operations () |
DataFlowInterface * | ports () |
const DataFlowInterface * | ports () const |
PropertyBag * | properties () |
PropertyBag * | properties () |
Service::shared_ptr | provides (const std::string &service_name) |
Service::shared_ptr | provides () |
Service::shared_ptr | provides () |
Service::shared_ptr | provides (const std::string &service_name) |
virtual bool | ready () |
virtual void | removePeer (const std::string &name) |
virtual void | removePeer (TaskContext *peer) |
virtual void | removePeer (TaskContext *peer) |
virtual void | removePeer (const std::string &name) |
ServiceRequester::shared_ptr | requires (const std::string &service_name) |
ServiceRequester::shared_ptr | requires (const std::string &service_name) |
ServiceRequester::shared_ptr | requires () |
ServiceRequester::shared_ptr | requires () |
bool | setActivity (base::ActivityInterface *new_act) |
virtual bool | start () |
virtual bool | stop () |
TaskContext (const std::string &name, TaskState initial_state=Stopped) | |
virtual | ~TaskContext () |
Public Member Functions inherited from RTT::base::TaskCore | |
virtual bool | activate () |
virtual bool | activate () |
virtual bool | cleanup () |
virtual bool | cleanup () |
virtual bool | configure () |
virtual bool | configure () |
const ExecutionEngine * | engine () const |
ExecutionEngine * | engine () |
virtual void | error () |
virtual void | error () |
virtual unsigned | getCpuAffinity () const |
virtual unsigned | getCpuAffinity () const |
unsigned int | getCycleCounter () const |
unsigned int | getIOCounter () const |
virtual Seconds | getPeriod () const |
virtual Seconds | getPeriod () const |
virtual TaskState | getTargetState () const |
virtual TaskState | getTaskState () const |
unsigned int | getTimeOutCounter () const |
unsigned int | getTriggerCounter () const |
virtual bool | inException () const |
virtual bool | inException () const |
virtual bool | inFatalError () const |
virtual bool | inFatalError () const |
virtual bool | inRunTimeError () const |
virtual bool | inRunTimeError () const |
virtual bool | isActive () const |
virtual bool | isActive () const |
virtual bool | isConfigured () const |
virtual bool | isConfigured () const |
virtual bool | isRunning () const |
virtual bool | isRunning () const |
virtual bool | recover () |
virtual bool | recover () |
virtual bool | setCpuAffinity (unsigned cpu) |
virtual bool | setCpuAffinity (unsigned cpu) |
virtual bool | setPeriod (Seconds s) |
virtual bool | setPeriod (Seconds s) |
TaskCore (TaskState initial_state=Stopped, const std::string &name=std::string()) | |
virtual bool | trigger () |
virtual bool | trigger () |
virtual bool | update () |
virtual bool | update () |
virtual | ~TaskCore () |
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 Member Functions inherited from RTT::TaskContext | |
virtual void | dataOnPortCallback (base::PortInterface *port) |
virtual bool | dataOnPortHook (base::PortInterface *port) |
void | forceActivity (base::ActivityInterface *new_act) |
Protected Member Functions inherited from RTT::base::TaskCore | |
virtual bool | breakUpdateHook () |
virtual void | cleanupHook () |
virtual bool | configureHook () |
virtual void | errorHook () |
virtual void | exception () |
virtual void | exceptionHook () |
virtual void | fatal () |
virtual bool | startHook () |
virtual void | stopHook () |
virtual void | updateHook () |
Protected Attributes | |
std::string | macroname |
bool | macrorecording |
std::string | macrotext |
std::stringstream | sresult |
Protected Attributes inherited from RTT::base::TaskCore | |
ExecutionEngine * | ee |
unsigned int | mCycleCounter |
unsigned int | mIOCounter |
std::string | mName |
TaskState | mTaskState |
unsigned int | mTimeOutCounter |
unsigned int | mTriggerCounter |
bool | mTriggerOnStart |
Private Types | |
typedef std::map< std::pair< RTT::TaskContext *, std::string >, int > | PTrace |
Static Private Member Functions | |
static RTT::TaskContext * | findPeer (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 More... | |
std::string | storedname |
PTrace | straces |
std::deque< RTT::TaskContext * > | taskHistory |
bool | usehex |
last program line number listed to screen More... | |
Static Private Attributes | |
static RTT::TaskContext * | context = 0 |
static RTT::TaskContext * | peer = 0 |
static RTT::TaskContext * | taskcontext = 0 |
static RTT::Service::shared_ptr | taskobject |
static RTT::TaskContext * | tb = 0 |
Additional Inherited Members | |
Public Attributes inherited from RTT::base::TaskCore | |
Exception | |
FatalError | |
Init | |
PreOperational | |
Running | |
RunTimeError | |
Stopped | |
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.
|
private |
Definition at line 112 of file TaskBrowser.hpp.
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 185 of file TaskBrowser.hpp.
OCL::TaskBrowser::TaskBrowser | ( | RTT::TaskContext * | c | ) |
Create a TaskBrowser which initially visits a given RTT::TaskContext c.
Definition at line 740 of file TaskBrowser.cpp.
OCL::TaskBrowser::~TaskBrowser | ( | ) |
Definition at line 787 of file TaskBrowser.cpp.
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 1212 of file TaskBrowser.cpp.
|
protected |
Definition at line 1020 of file TaskBrowser.cpp.
|
protected |
Definition at line 1060 of file TaskBrowser.cpp.
|
protected |
Definition at line 1735 of file TaskBrowser.cpp.
|
protected |
Definition at line 1030 of file TaskBrowser.cpp.
|
protected |
Definition at line 978 of file TaskBrowser.cpp.
void OCL::TaskBrowser::evalCommand | ( | std::string & | comm | ) |
Evaluate command
Definition at line 1606 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 1411 of file TaskBrowser.cpp.
|
staticprivate |
Definition at line 1189 of file TaskBrowser.cpp.
|
protected |
Definition at line 988 of file TaskBrowser.cpp.
|
protected |
Definition at line 2080 of file TaskBrowser.cpp.
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 844 of file TaskBrowser.cpp.
bool OCL::TaskBrowser::printGlobals | ( | ) |
Print GlobalsRepository attributes and constants.
Definition at line 1564 of file TaskBrowser.cpp.
void OCL::TaskBrowser::printHelp | ( | ) |
Print the help page.
Definition at line 1858 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 2106 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 2315 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 2003 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 2046 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 1724 of file TaskBrowser.cpp.
bool OCL::TaskBrowser::printService | ( | const std::string | name | ) |
Print the synopsis of a Service.
Definition at line 1447 of file TaskBrowser.cpp.
void OCL::TaskBrowser::printSource | ( | const std::string | m | ) |
Print the synopsis of a DataSource.
|
protected |
Definition at line 998 of file TaskBrowser.cpp.
void OCL::TaskBrowser::setColorTheme | ( | ColorTheme | t | ) |
Definition at line 1077 of file TaskBrowser.cpp.
|
protected |
Definition at line 1415 of file TaskBrowser.cpp.
void OCL::TaskBrowser::switchBack | ( | ) |
Go to the previous peer in the visit history.
Definition at line 1050 of file TaskBrowser.cpp.
void OCL::TaskBrowser::switchTask | ( | RTT::TaskContext * | c | ) |
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".
path | The path to the target peer. |
Definition at line 1124 of file TaskBrowser.cpp.
void OCL::TaskBrowser::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 1146 of file TaskBrowser.cpp.
|
private |
Definition at line 98 of file TaskBrowser.hpp.
|
static |
The blue color.
Definition at line 327 of file TaskBrowser.hpp.
|
static |
The 'turn color off' escape sequence.
Definition at line 312 of file TaskBrowser.hpp.
|
static |
The 'turn color on' escape sequence.
Definition at line 304 of file TaskBrowser.hpp.
|
staticprivate |
Definition at line 96 of file TaskBrowser.hpp.
|
private |
Definition at line 100 of file TaskBrowser.hpp.
|
static |
The green color.
Definition at line 322 of file TaskBrowser.hpp.
|
private |
Definition at line 117 of file TaskBrowser.hpp.
|
private |
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.
|
private |
Definition at line 103 of file TaskBrowser.hpp.
|
private |
Definition at line 102 of file TaskBrowser.hpp.
|
protected |
Definition at line 172 of file TaskBrowser.hpp.
|
protected |
Definition at line 170 of file TaskBrowser.hpp.
|
protected |
Definition at line 171 of file TaskBrowser.hpp.
|
staticprivate |
Definition at line 92 of file TaskBrowser.hpp.
|
static |
The prompt.
Definition at line 300 of file TaskBrowser.hpp.
|
private |
Definition at line 113 of file TaskBrowser.hpp.
|
static |
The red color.
Definition at line 317 of file TaskBrowser.hpp.
|
protected |
Definition at line 173 of file TaskBrowser.hpp.
|
private |
last program listed to screen
Definition at line 106 of file TaskBrowser.hpp.
|
private |
Definition at line 105 of file TaskBrowser.hpp.
|
private |
Definition at line 114 of file TaskBrowser.hpp.
|
staticprivate |
Definition at line 90 of file TaskBrowser.hpp.
|
private |
Definition at line 109 of file TaskBrowser.hpp.
|
staticprivate |
Definition at line 97 of file TaskBrowser.hpp.
|
staticprivate |
Definition at line 94 of file TaskBrowser.hpp.
|
static |
The 'underline' escape sequence.
Definition at line 308 of file TaskBrowser.hpp.
|
private |
last program line number listed to screen
Definition at line 107 of file TaskBrowser.hpp.