SimplePeriodicTask< Functor > Class Template Reference

Usage: More...

#include <ArmarXCore/core/services/tasks/TaskUtil.h>

+ Inheritance diagram for SimplePeriodicTask< Functor >:

Public Member Functions

void runningFn ()
 
 SimplePeriodicTask (Functor f, int periodMs, bool assureMeanInterval=false, std::string name="", bool forceSystemTime=true)
 
- Public Member Functions inherited from PeriodicTask< T >
void changeInterval (unsigned int intervalInMs)
 changeInterval changes the interval at which the task is executed.
 
IceUtil::Int64 getInterval () const
 
const PeriodicTaskIceBase & getStatistics () const
 
bool isFunctionExecuting () const
 Return the execution state of the thread function.
 
bool isRunning () const
 Retrieve running state of the thread.
 
 PeriodicTask (T *parent, method_type periodicFn, int periodMs, bool assureMeanInterval=false, std::string name="", bool forceSystemTime=true)
 Constructs a periodic task within the class parent which calls the peridoicFn in a new thread.
 
void setDelayWarningTolerance (int newToleranceInMilliSeconds=5)
 
void setName (std::string name)
 Set the name identifying PeriodicTask instances.
 
void setThreadList (ThreadListPtr threadList)
 This method sets threadList as PeriodicTask::customThreadList and appends this to the list.
 
void start ()
 Starts the thread.
 
void stop ()
 Stops the thread.
 
 ~PeriodicTask () override
 Destructor stops the thread and waits for completion.
 
- Public Member Functions inherited from Logging
SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
 disables the logging for the current line for the given amount of seconds.
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set.
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Public Attributes

Functor f
 

Additional Inherited Members

- Public Types inherited from PeriodicTask< T >
typedef void(T::* method_type) (void)
 Typedef for the periodic method.
 
using pointer_type = IceUtil::Handle<PeriodicTask<T>>
 Shared pointer type for convenience.
 
- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtrgetLogSender () const
 Retrieve log sender.
 
LogSenderPtr loghelper (const char *file, int line, const char *function) const
 
- Protected Attributes inherited from Logging
MessageTypeT minimumLoggingLevel
 
SpamFilterDataPtr spamFilter
 
LogTag tag
 

Detailed Description

template<class Functor = std::function<void(void)>>
class armarx::SimplePeriodicTask< Functor >

Usage:

   SimplePeriodicTask<>::pointer_type task = new SimplePeriodicTask<>([&]
   {
      ARMARX_INFO << "Hello world from another thread";
   }, 100);
   task->start();

Definition at line 45 of file TaskUtil.h.

Constructor & Destructor Documentation

◆ SimplePeriodicTask()

template<class Functor = std::function<void(void)>>
SimplePeriodicTask ( Functor f,
int periodMs,
bool assureMeanInterval = false,
std::string name = "",
bool forceSystemTime = true )
inline

Definition at line 48 of file TaskUtil.h.

Member Function Documentation

◆ runningFn()

template<class Functor = std::function<void(void)>>
void runningFn ( )
inline

Definition at line 64 of file TaskUtil.h.

Member Data Documentation

◆ f

template<class Functor = std::function<void(void)>>
Functor f

Definition at line 69 of file TaskUtil.h.


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