00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 // This file is part of FZIs ic_workspace. 00005 // 00006 // This program is free software licensed under the LGPL 00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00008 // You can find a copy of this license in LICENSE folder in the top 00009 // directory of the source code. 00010 // 00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00012 // 00013 // -- END LICENSE BLOCK ------------------------------------------------ 00014 00015 //---------------------------------------------------------------------- 00029 //---------------------------------------------------------------------- 00030 #ifndef ICL_CORE_THREAD_PERIODIC_THREAD_H_INCLUDED 00031 #define ICL_CORE_THREAD_PERIODIC_THREAD_H_INCLUDED 00032 00033 #include <icl_core/BaseTypes.h> 00034 #include <icl_core/Noncopyable.h> 00035 #include <icl_core/TimeSpan.h> 00036 #include <icl_core/os_thread.h> 00037 00038 #include "icl_core_thread/ImportExport.h" 00039 #include "icl_core_thread/Thread.h" 00040 00041 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00042 # include "icl_core/Deprecate.h" 00043 #endif 00044 00045 namespace icl_core { 00046 namespace thread { 00047 00048 class PeriodicThreadImpl; 00049 00055 class ICL_CORE_THREAD_IMPORT_EXPORT PeriodicThread : public Thread, 00056 protected virtual icl_core::Noncopyable 00057 { 00058 public: 00066 PeriodicThread(const icl_core::String& description, const icl_core::TimeSpan& period, 00067 ThreadPriority priority = 0); 00068 00071 virtual ~PeriodicThread(); 00072 00075 icl_core::TimeSpan period() const; 00076 00082 bool setPeriod(const icl_core::TimeSpan& period); 00083 00085 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00086 00090 ICL_CORE_VC_DEPRECATE_STYLE icl_core::TimeSpan Period() const 00091 ICL_CORE_GCC_DEPRECATE_STYLE; 00092 00096 ICL_CORE_VC_DEPRECATE_STYLE bool SetPeriod(const icl_core::TimeSpan& period) 00097 ICL_CORE_GCC_DEPRECATE_STYLE; 00098 00099 #endif 00100 00101 00102 protected: 00105 void waitPeriod(); 00106 00108 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00109 00113 ICL_CORE_VC_DEPRECATE_STYLE void WaitPeriod() ICL_CORE_GCC_DEPRECATE_STYLE; 00114 00115 #endif 00116 00117 00118 private: 00119 virtual void makePeriodic(); 00120 00121 PeriodicThreadImpl *m_impl; 00122 }; 00123 00124 } 00125 } 00126 00127 #endif