YARP  2.3.68+228-20170410.2+git7d0b2e0
Yet Another Robot Platform
ModuleHelper Class Reference
+ Inheritance diagram for ModuleHelper:

Public Member Functions

 ModuleHelper (Module &owner)
 
virtual bool read (yarp::os::ConnectionReader &connection)
 Handler for reading messages from the network, and passing them on to the respond() method. More...
 
virtual void onRead (yarp::os::Bottle &v)
 Alternative handler for reading messages from the network, and passing them on to the respond() method. More...
 
bool attach (yarp::os::TypedReader< yarp::os::Bottle > &source, bool handleStream)
 Attach this object to a source of messages. More...
 
bool attach (yarp::os::Port &source)
 
virtual void run ()
 Main body of the new thread. More...
 
virtual void report (const SearchReport &report, const char *context)
 
Bottle getOptions ()
 
ConstString getComment (const char *option)
 
Value getDefaultValue (const char *option)
 
Value getValue (const char *option)
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType ()
 
- Public Member Functions inherited from yarp::os::TypedReaderCallback< yarp::os::Bottle >
virtual ~TypedReaderCallback ()
 Destructor. More...
 
virtual void onRead (yarp::os::Bottle &datum, const yarp::os::TypedReader< yarp::os::Bottle > &reader)
 Callback method. More...
 
- Public Member Functions inherited from yarp::os::Thread
 Thread ()
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
virtual void onStop ()
 Call-back, called while halting the thread (before join). More...
 
bool start ()
 Start the new thread running. More...
 
bool stop ()
 Stop the thread. More...
 
virtual void beforeStart ()
 Called just before a new thread starts. More...
 
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(). More...
 
virtual bool threadInit ()
 Initialization method. More...
 
virtual void threadRelease ()
 Release method. More...
 
bool isStopping ()
 Returns true if the thread is stopping (Thread::stop has been called). More...
 
bool isRunning ()
 Returns true if the thread is running (Thread::start has been called successfully and the thread has not stopped). More...
 
void setOptions (int stackSize=0)
 Set the stack size for the new thread. More...
 
long int getKey ()
 Get a unique identifier for the thread. More...
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that. More...
 
int getPriority ()
 Query the current priority of the thread, if the OS supports that. More...
 
int getPolicy ()
 Query the current scheduling policy of the thread, if the OS supports that. More...
 
bool join (double seconds=-1)
 The function returns when the thread execution has completed. More...
 

Private Attributes

Module & owner
 
Property comment
 
Property fallback
 
Property present
 
Property actual
 
Property reported
 
Bottle order
 

Additional Inherited Members

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

Detailed Description

Definition at line 28 of file Module.cpp.

Constructor & Destructor Documentation

◆ ModuleHelper()

ModuleHelper::ModuleHelper ( Module &  owner)
inline

Definition at line 37 of file Module.cpp.

Member Function Documentation

◆ attach() [1/2]

bool ModuleHelper::attach ( yarp::os::TypedReader< yarp::os::Bottle > &  source,
bool  handleStream 
)
inline

Attach this object to a source of messages.

Parameters
sourcea BufferedPort or PortReaderBuffer that receives data.

Definition at line 64 of file Module.cpp.

◆ attach() [2/2]

bool ModuleHelper::attach ( yarp::os::Port source)
inline

Definition at line 74 of file Module.cpp.

◆ getComment()

ConstString ModuleHelper::getComment ( const char *  option)
inline

Definition at line 187 of file Module.cpp.

◆ getDefaultValue()

Value ModuleHelper::getDefaultValue ( const char *  option)
inline

Definition at line 192 of file Module.cpp.

◆ getOptions()

Bottle ModuleHelper::getOptions ( )
inline

Definition at line 183 of file Module.cpp.

◆ getValue()

Value ModuleHelper::getValue ( const char *  option)
inline

Definition at line 196 of file Module.cpp.

◆ onRead()

virtual void ModuleHelper::onRead ( yarp::os::Bottle v)
inlinevirtual

Alternative handler for reading messages from the network, and passing them on to the respond() method.

There can be no replies made if this handler is used.

Parameters
vthe message

Reimplemented from yarp::os::TypedReaderCallback< yarp::os::Bottle >.

Definition at line 54 of file Module.cpp.

◆ read()

bool ModuleHelper::read ( yarp::os::ConnectionReader connection)
virtual

Handler for reading messages from the network, and passing them on to the respond() method.

Parameters
connectiona network connection to a port
Returns
true if the message was read successfully

Implements yarp::os::PortReader.

Definition at line 203 of file Module.cpp.

◆ report()

virtual void ModuleHelper::report ( const SearchReport &  report,
const char *  context 
)
inlinevirtual

Definition at line 115 of file Module.cpp.

◆ run()

virtual void ModuleHelper::run ( )
inlinevirtual

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 79 of file Module.cpp.

Member Data Documentation

◆ actual

Property ModuleHelper::actual
private

Definition at line 112 of file Module.cpp.

◆ comment

Property ModuleHelper::comment
private

Definition at line 112 of file Module.cpp.

◆ fallback

Property ModuleHelper::fallback
private

Definition at line 112 of file Module.cpp.

◆ order

Bottle ModuleHelper::order
private

Definition at line 113 of file Module.cpp.

◆ owner

Module& ModuleHelper::owner
private

Definition at line 34 of file Module.cpp.

◆ present

Property ModuleHelper::present
private

Definition at line 112 of file Module.cpp.

◆ reported

Property ModuleHelper::reported
private

Definition at line 112 of file Module.cpp.


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