Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
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]

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::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 
base::InputPortInterfaceaddEventPort (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::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
 
base::PortInterfaceaddPort (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)
 
ConfigurationInterfaceattributes ()
 
ConfigurationInterfaceattributes ()
 
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::ActivityInterfacegetActivity ()
 
T * getActivity ()
 
base::AttributeBasegetAttribute (const std::string &name) const
 
base::AttributeBasegetAttribute (const std::string &name) const
 
virtual const std::string & getName () const
 
OperationInterfacePartgetOperation (std::string name)
 
OperationInterfacePartgetOperation (std::string name)
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
virtual TaskContextgetPeer (const std::string &peer_name) const
 
virtual PeerList getPeerList () const
 
virtual PeerList getPeerList () const
 
base::PortInterfacegetPort (const std::string &name) const
 
base::PropertyBasegetProperty (const std::string &name) const
 
base::PropertyBasegetProperty (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)
 
OperationInterfaceoperations ()
 
OperationInterfaceoperations ()
 
DataFlowInterfaceports ()
 
const DataFlowInterfaceports () const
 
PropertyBagproperties ()
 
PropertyBagproperties ()
 
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 ExecutionEngineengine () const
 
ExecutionEngineengine ()
 
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
ExecutionEngineee
 
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::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 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::TaskContextcontext = 0
 
static RTT::TaskContextpeer = 0
 
static RTT::TaskContexttaskcontext = 0
 
static RTT::Service::shared_ptr taskobject
 
static RTT::TaskContexttb = 0
 

Additional Inherited Members

- Public Attributes inherited from RTT::base::TaskCore
 Exception
 
 FatalError
 
 Init
 
 PreOperational
 
 Running
 
 RunTimeError
 
 Stopped
 

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

OCL::TaskBrowser::~TaskBrowser ( )

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

void OCL::TaskBrowser::cancelMacro ( )
protected

Definition at line 1020 of file TaskBrowser.cpp.

void OCL::TaskBrowser::checkPorts ( )
protected

Definition at line 1060 of file TaskBrowser.cpp.

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

Definition at line 1735 of file TaskBrowser.cpp.

void OCL::TaskBrowser::endMacro ( )
protected

Definition at line 1030 of file TaskBrowser.cpp.

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

RTT::TaskContext * OCL::TaskBrowser::findPeer ( std::string  comm)
staticprivate

Definition at line 1189 of file TaskBrowser.cpp.

void OCL::TaskBrowser::leaveTask ( )
protected

Definition at line 988 of file TaskBrowser.cpp.

void OCL::TaskBrowser::listText ( std::stringstream &  txtss,
int  start,
int  end,
int  ln,
char  s 
)
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.

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

Definition at line 998 of file TaskBrowser.cpp.

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

Definition at line 1077 of file TaskBrowser.cpp.

Service::shared_ptr OCL::TaskBrowser::stringToService ( std::string const &  names)
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".

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

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

Definition at line 1146 of file TaskBrowser.cpp.

Member Data Documentation

RTT::internal::DataSource<bool>::shared_ptr OCL::TaskBrowser::accepted
private

Definition at line 98 of file TaskBrowser.hpp.

string OCL::TaskBrowser::blue
static

The blue color.

Definition at line 327 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::coloroff
static

The 'turn color off' escape sequence.

Definition at line 312 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::coloron
static

The 'turn color on' escape sequence.

Definition at line 304 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::context = 0
staticprivate

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 322 of file TaskBrowser.hpp.

const char* OCL::TaskBrowser::histfile
private

Definition at line 117 of file TaskBrowser.hpp.

base::DataSourceBase::shared_ptr OCL::TaskBrowser::last_expr
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.

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 172 of file TaskBrowser.hpp.

bool OCL::TaskBrowser::macrorecording
protected

Definition at line 170 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::macrotext
protected

Definition at line 171 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::peer = 0
staticprivate

Definition at line 92 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::prompt
static

The prompt.

Definition at line 300 of file TaskBrowser.hpp.

PTrace OCL::TaskBrowser::ptraces
private

Definition at line 113 of file TaskBrowser.hpp.

string OCL::TaskBrowser::red
static

The red color.

Definition at line 317 of file TaskBrowser.hpp.

std::stringstream OCL::TaskBrowser::sresult
protected

Definition at line 173 of file TaskBrowser.hpp.

int OCL::TaskBrowser::storedline
private

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.

PTrace OCL::TaskBrowser::straces
private

Definition at line 114 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::taskcontext = 0
staticprivate

Definition at line 90 of file TaskBrowser.hpp.

std::deque<RTT::TaskContext*> OCL::TaskBrowser::taskHistory
private

Definition at line 109 of file TaskBrowser.hpp.

Service::shared_ptr OCL::TaskBrowser::taskobject
staticprivate

Definition at line 97 of file TaskBrowser.hpp.

RTT::TaskContext * OCL::TaskBrowser::tb = 0
staticprivate

Definition at line 94 of file TaskBrowser.hpp.

std::string OCL::TaskBrowser::underline
static

The 'underline' escape sequence.

Definition at line 308 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 Wed Jun 26 2019 19:26:27