|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #define YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
12 #undef YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
179 this->helper = helper;
186 this->helper = &helper;
207 this->helper = &helper;
215 this->helper = helper;
224 period = (1.0 / framerate);
225 yCInfo(RATETHREAD,
"Setting framerate to: %.0lf[Hz] (thread period %f[s])\n", framerate, period);
227 yCInfo(RATETHREAD,
"No framerate specified, polling the device");
249 if (helper !=
nullptr) {
256 if (helper !=
nullptr) {
264 if (helper !=
nullptr) {
271 if (helper !=
nullptr) {
278 if (helper !=
nullptr) {
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
SystemRateThread(int period)
RateThreadWrapper()
Default constructor.
void resume()
Resume the thread if previously suspended.
unsigned int getIterations()
Return the number of iterations performed since last reset.
virtual void afterStart(bool success)
Should be called from the creator after the thread exists and before a call that requested the thread...
int getPolicy() const
Query the current scheduling policy of the thread, if the OS supports that.
bool step()
Call this to "step" the thread rather than starting it.
bool open(double framerate=-1, bool polling=false)
bool threadInit() override
Initialization method.
Runnable * getAttachment() const
int setPriority(int priority, int policy=-1)
Set the priority and scheduling policy of the thread, if the OS supports that.
void threadRelease() override
Release method.
int getPriority() const
Query the current priority of the thread, if the OS supports that.
double getEstPeriod()
Return estimated period since last reset.
virtual bool threadInit()
Initialization method.
virtual void threadRelease()
Release method.
virtual bool attach(Runnable &helper)
void afterStart(bool success) override
Called just after a new thread starts (or fails to start), this is executed by the same thread that c...
double getEstimatedUsed() const
Return the estimated duration of the run() function since last reset.
bool threadInit() override
Initialization method.
double getPeriod() const
Return the current period of the thread.
A class that can be managed by another thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
double getEstimatedPeriod() const
Return estimated period since last reset.
int getPolicy()
Query the current scheduling policy of the thread, if the OS supports that.
int getPriority()
Query the current priority of the thread, if the OS supports that.
RateThread(int period)
Constructor.
double getEstUsed()
Return the estimated duration of the run() function since last reset.
virtual ~RateThreadWrapper()
void resetStat()
Reset thread statistics.
void beforeStart() override
Called just before a new thread starts.
bool start()
Call this to start the thread.
bool isSuspended()
Returns true when the thread is suspended, false otherwise.
bool setPeriod(double period)
Set the (new) period of the thread.
void suspend()
Suspend the thread, the thread keeps running by doLoop is never executed.
An abstraction for a periodic thread.
void afterStart(bool success) override
Called just after a new thread starts (or fails to start), this is executed by the same thread that c...
virtual void beforeStart()
Should be called from the creator before the thread exists and before a call that requested the threa...
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
int setPriority(int priority, int policy=-1)
Set the priority and scheduling policy of the thread, if the OS supports that.
#define yCInfo(component,...)
void run() override
Loop function.
void askToStop()
Stop the thread.
bool start()
Call this to start the thread.
An interface to the operating system, including Port based communication.
void askToStop()
Stop the thread.
bool setRate(int period)
Set the (new) rate of the thread.
unsigned int getIterations() const
Return the number of iterations performed since last reset.
bool isSuspended() const
Returns true when the thread is suspended, false otherwise.
virtual ~SystemRateThread()
void resume()
Resume the thread if previously suspended.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
double getRate()
Return the current rate of the thread.
void step()
Call this to "step" the thread rather than starting it.
void beforeStart() override
Called just before a new thread starts.
void threadRelease() override
Release method.
#define YARP_OS_LOG_COMPONENT(name, name_string)
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
void suspend()
Suspend the thread, the thread keeps running by doLoop is never executed.
bool isRunning()
Returns true when the thread is started, false otherwise.
virtual void run()
Body to run - could be periodic or continuous.
void resetStat()
Reset thread statistics.