00001 //================================================================================================== 00002 // Copyright (C) 2010 Brian Tietz sdbtietz at yahoo dot com 00003 // 00004 // This program is free software; you can redistribute it and/or modify it under the terms of the 00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the 00006 // License. 00007 // 00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00010 // General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU General Public License along with this program; if 00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00014 // 02110-1301, USA. 00015 // 00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com) 00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that 00018 // license as applied to the UT library in exchange for either substantial contributions to the 00019 // development of the UT library or other forms of compensation. Any such waiver must be 00020 // established in writing between the copyright holder and the commercial entity obtaining such a 00021 // waiver. 00022 //================================================================================================== 00023 00024 00025 #ifndef _UT_IDLE_ADD_REMOVE_TASK_H_ 00026 #define _UT_IDLE_ADD_REMOVE_TASK_H_ 00027 00028 00029 //================================================================================================== 00030 //=== Project headers 00031 //================================================================================================== 00032 #include "UTMessage.h" 00033 #include "UTTask.h" 00034 00035 00036 //================================================================================================== 00037 //=== Forward name declarations 00038 //================================================================================================== 00039 class IdleTask_t; 00040 00041 00042 // \cond DOXYGEN_DOCUMENT_NEVER 00043 00044 //================================================================================================== 00045 class IdleAddRemoveMessage_t 00046 //================================================================================================== 00047 : public Message_t 00048 { 00049 //---------------------------------------------------------------------------------------------- 00050 public: 00051 //---------------------------------------------------------------------------------------------- 00052 inline IdleAddRemoveMessage_t( bool add, IdleTask_t* task ); 00053 00054 //---------------------------------------------------------------------------------------------- 00055 private: 00056 //---------------------------------------------------------------------------------------------- 00057 bool m_add; 00058 IdleTask_t* m_task; 00059 00060 friend class IdleAddRemoveTask_t; 00061 }; 00062 00063 00064 //================================================================================================== 00065 class IdleAddRemoveTask_t 00066 //================================================================================================== 00067 : public Task_t 00068 { 00069 //---------------------------------------------------------------------------------------------- 00070 public: 00071 //---------------------------------------------------------------------------------------------- 00072 IdleAddRemoveTask_t(); 00073 00074 //---------------------------------------------------------------------------------------------- 00075 protected: 00076 //---------------------------------------------------------------------------------------------- 00077 virtual quit_response_t QuitRequested(); 00078 00079 //---------------------------------------------------------------------------------------------- 00080 public: 00081 //---------------------------------------------------------------------------------------------- 00082 void AddReceived(const IdleAddRemoveMessage_t* message); 00083 MessageReceiver_t< IdleAddRemoveTask_t, IdleAddRemoveMessage_t > m_AddReceiver; 00084 00085 void RemoveReceived(const IdleAddRemoveMessage_t* message); 00086 MessageReceiver_t< IdleAddRemoveTask_t, IdleAddRemoveMessage_t > m_RemoveReceiver; 00087 }; 00088 00089 00090 00091 00092 //================================================================================================== 00093 //================================================================================================== 00094 //=== 00095 //=== Inline function implementations 00096 //=== 00097 //================================================================================================== 00098 //================================================================================================== 00099 inline 00100 IdleAddRemoveMessage_t::IdleAddRemoveMessage_t( bool add, IdleTask_t* task ) 00101 { 00102 m_add = add; 00103 m_task = task; 00104 } 00105 00106 00107 // \endcond 00108 00109 #endif // _UT_IDLE_ADD_REMOVE_TASK_H_