YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::manager::LocalBroker Class Reference

Class LocalBroker. More...

#include <yarp/manager/localbroker.h>

+ Inheritance diagram for yarp::manager::LocalBroker:

Public Types

enum  WindowMode {
  WINDOW_HIDDEN =0 ,
  WINDOW_VISIBLE =1 ,
  WINDOW_MINIMIZED =2
}
 

Public Member Functions

 LocalBroker ()
 
virtual ~LocalBroker ()
 
bool init () override
 
bool init (const char *szcmd, const char *szparam, const char *szhost, const char *szstdio, const char *szworkdir, const char *szenv) override
 
void fini () override
 
bool start () override
 
bool stop () override
 
bool kill () override
 
bool connect (const std::string &from, const std::string &to, const std::string &carrier, bool persist=false) override
 connection broker
 
bool disconnect (const std::string &from, const std::string &to, const std::string &carrier) override
 
int running () override
 
bool exists (const std::string &port) override
 
std::string requestRpc (const std::string &szport, const std::string &request, double timeout) override
 
bool connected (const std::string &from, const std::string &to, const std::string &carrier) override
 
std::string error () override
 
bool initialized () override
 
bool attachStdout () override
 
void detachStdout () override
 
void setWindowMode (WindowMode m)
 Define if the application will be visible or not.
 
void run () override
 Main body of the new thread.
 
bool threadInit () override
 Initialization method.
 
void threadRelease () override
 Release method.
 
- Public Member Functions inherited from yarp::manager::Broker
 Broker ()
 
virtual ~Broker ()
 
void setEventSink (BrokerEventSink *pEventSink)
 
unsigned int generateID ()
 
void enableWatchDog ()
 
void disableWatchDog ()
 
bool hasWatchDog ()
 
void setDisplay (const char *szDisplay)
 
std::string getDisplay () const
 
- Public Member Functions inherited from yarp::os::Thread
 Thread ()
 Constructor.
 
virtual ~Thread ()
 Destructor.
 
virtual void onStop ()
 Call-back, called while halting the thread (before join).
 
bool start ()
 Start the new thread running.
 
bool stop ()
 Stop the thread.
 
virtual void beforeStart ()
 Called just before a new thread starts.
 
virtual void afterStart (bool success)
 Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start().
 
bool isStopping ()
 Returns true if the thread is stopping (Thread::stop has been called).
 
bool isRunning ()
 Returns true if the thread is running (Thread::start has been called successfully and the thread has not stopped).
 
long int getKey ()
 Get a unique identifier for the thread.
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that.
 
int getPriority ()
 Query the current priority of the thread, if the OS supports that.
 
int getPolicy ()
 Query the current scheduling policy of the thread, if the OS supports that.
 
bool join (double seconds=-1)
 The function returns when the thread execution has completed.
 
void setOptions (int stackSize=0)
 Set the stack size for the new thread.
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Thread
static int getCount ()
 Check how many threads are running.
 
static long int getKeyOfCaller ()
 Get a unique identifier for the calling thread.
 
static void yield ()
 Reschedule the execution of current thread, allowing other threads to run.
 
static void setDefaultStackSize (int stackSize)
 Set the default stack size for all threads created after this point.
 
- Protected Attributes inherited from yarp::manager::Broker
unsigned int UNIQUEID
 
BrokerEventSinkeventSink
 
bool bWithWatchDog
 
std::string strDisplay
 

Detailed Description

Class LocalBroker.

Definition at line 33 of file localbroker.h.

Member Enumeration Documentation

◆ WindowMode

Enumerator
WINDOW_HIDDEN 
WINDOW_VISIBLE 
WINDOW_MINIMIZED 

Definition at line 37 of file localbroker.h.

Constructor & Destructor Documentation

◆ LocalBroker()

LocalBroker::LocalBroker ( )

Definition at line 140 of file localbroker.cpp.

◆ ~LocalBroker()

LocalBroker::~LocalBroker ( )
virtual

Definition at line 149 of file localbroker.cpp.

Member Function Documentation

◆ attachStdout()

bool LocalBroker::attachStdout ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 508 of file localbroker.cpp.

◆ connect()

bool LocalBroker::connect ( const std::string &  from,
const std::string &  to,
const std::string &  carrier,
bool  persist = false 
)
overridevirtual

connection broker

Implements yarp::manager::Broker.

Definition at line 358 of file localbroker.cpp.

◆ connected()

bool LocalBroker::connected ( const std::string &  from,
const std::string &  to,
const std::string &  carrier 
)
overridevirtual

Implements yarp::manager::Broker.

Definition at line 494 of file localbroker.cpp.

◆ detachStdout()

void LocalBroker::detachStdout ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 521 of file localbroker.cpp.

◆ disconnect()

bool LocalBroker::disconnect ( const std::string &  from,
const std::string &  to,
const std::string &  carrier 
)
overridevirtual

Implements yarp::manager::Broker.

Definition at line 397 of file localbroker.cpp.

◆ error()

std::string LocalBroker::error ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 503 of file localbroker.cpp.

◆ exists()

bool LocalBroker::exists ( const std::string &  port)
overridevirtual

Implements yarp::manager::Broker.

Definition at line 441 of file localbroker.cpp.

◆ fini()

void LocalBroker::fini ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 154 of file localbroker.cpp.

◆ init() [1/2]

bool LocalBroker::init ( )
overridevirtual

Implements yarp::manager::Broker.

Reimplemented in yarp::manager::ScriptLocalBroker.

Definition at line 161 of file localbroker.cpp.

◆ init() [2/2]

bool LocalBroker::init ( const char szcmd,
const char szparam,
const char szhost,
const char szstdio,
const char szworkdir,
const char szenv 
)
overridevirtual

◆ initialized()

bool yarp::manager::LocalBroker::initialized ( )
inlineoverridevirtual

Implements yarp::manager::Broker.

Definition at line 60 of file localbroker.h.

◆ kill()

bool LocalBroker::kill ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 308 of file localbroker.cpp.

◆ requestRpc()

std::string LocalBroker::requestRpc ( const std::string &  szport,
const std::string &  request,
double  timeout 
)
overridevirtual

Implements yarp::manager::Broker.

Definition at line 447 of file localbroker.cpp.

◆ run()

void LocalBroker::run ( )
overridevirtual

Main body of the new thread.

Override this method to do what you want. After Thread::start is called, this method will start running in a separate thread. It is important that this method either keeps checking Thread::isStopping to see if it should stop, or you override the Thread::onStop method to interact with it in some way to shut the new thread down. There is no really reliable, portable way to stop a thread cleanly unless that thread cooperates.

Implements yarp::os::Thread.

Definition at line 542 of file localbroker.cpp.

◆ running()

int LocalBroker::running ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 343 of file localbroker.cpp.

◆ setWindowMode()

void LocalBroker::setWindowMode ( WindowMode  m)

Define if the application will be visible or not.

Definition at line 588 of file localbroker.cpp.

◆ start()

bool LocalBroker::start ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 249 of file localbroker.cpp.

◆ stop()

bool LocalBroker::stop ( )
overridevirtual

Implements yarp::manager::Broker.

Definition at line 275 of file localbroker.cpp.

◆ threadInit()

bool LocalBroker::threadInit ( )
overridevirtual

Initialization method.

The thread executes this function when it starts and before "run". This is a good place to perform initialization tasks that need to be done by the thread itself (device drivers initialization, memory allocation etc). If the function returns false the thread quits and never calls "run". The return value of threadInit() is notified to the class and passed as a parameter to afterStart(). Note that afterStart() is called by the same thread that is executing the "start" method.

Reimplemented from yarp::os::Thread.

Definition at line 536 of file localbroker.cpp.

◆ threadRelease()

void LocalBroker::threadRelease ( )
overridevirtual

Release method.

The thread executes this function once when it exits, after the last "run". This is a good place to release resources that were initialized in threadInit() (release memory, and device driver resources).

Reimplemented from yarp::os::Thread.

Definition at line 583 of file localbroker.cpp.


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