TCMTMessage.h

Go to the documentation of this file.
00001 //*******************************************************************************
00002 //
00003 // *******   ***   ***               *
00004 //    *     *     *                  *
00005 //    *    *      *                *****
00006 //    *    *       ***  *   *   **   *    **    ***
00007 //    *    *          *  * *   *     *   ****  * * *
00008 //    *     *         *   *      *   * * *     * * *
00009 //    *      ***   ***    *     **   **   **   *   *
00010 //                        *
00011 //*******************************************************************************
00012 // see http://sourceforge.net/projects/tcsystem/ for details.
00013 // Copyright (C) 2003 - 2008 Thomas Goessler. All Rights Reserved. 
00014 //*******************************************************************************
00015 //
00016 // TCSystem is the legal property of its developers.
00017 // Please refer to the COPYRIGHT file distributed with this source distribution.
00018 // 
00019 // This library is free software; you can redistribute it and/or             
00020 // modify it under the terms of the GNU Lesser General Public                
00021 // License as published by the Free Software Foundation; either              
00022 // version 2.1 of the License, or (at your option) any later version.        
00023 //                                                                           
00024 // This library is distributed in the hope that it will be useful,           
00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of            
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00027 // Lesser General Public License for more details.                           
00028 //                                                                           
00029 // You should have received a copy of the GNU Lesser General Public          
00030 // License along with this library; if not, write to the Free Software       
00031 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00032 //*******************************************************************************
00033 //  $Id: TCMTMessage.h 870 2008-07-21 14:15:33Z the_____tiger $
00034 //*******************************************************************************
00035 
00036 #ifndef _TC_MT_MESSAGE_H_
00037 #define _TC_MT_MESSAGE_H_
00038 
00039 #include "TCMTApi.h"
00040 #include "TCNonCopyable.h"
00041 #include "TCSharedPtr.h"
00042 
00043 namespace TC
00044 {
00045 namespace MT
00046 {
00047    class Thread;
00048    typedef SharedPtr<Thread> ThreadPtr;
00049 
00065    class TCMT_API Message: protected NonCopyAble
00066    {
00067    public:
00069       enum MsgIDs
00070       {
00071          MSG_ID_QUIT       = 0x00000001, 
00072          MSG_ID_START      = 0x00000002, 
00073          MSG_ID_USER_START = 0x0000ffff, 
00074          MSG_ID_UNKNOWN    = 0xffffffff  
00075       };
00076 
00078       enum TimeOut
00079       {
00080          TIMEOUT_NO = 0,
00081          TIMEOUT_INFINITE = 0xffffffff
00082       };
00083 
00085       enum ReturnValue
00086       {
00087          MSG_RECEIVE_FAILED = 0,
00088          MSG_RECEIVE_TIMEOUT = 1,
00089          MSG_RECEIVED = 2,
00090          MSG_QUIT_RECEIVED = 3
00091       };
00092 
00094       Message(uint32 message_id);
00096       virtual ~Message();
00098       inline uint32 GetMessageId() const {return m_message_id;}
00100       inline ThreadPtr GetSenderThread() {return m_sender_thread;}
00101 
00102    private:
00104       uint32 m_message_id;
00106       ThreadPtr m_sender_thread;
00107    };
00108 
00110    typedef SharedPtr<Message> MessagePtr;
00111 
00116 } // namespace MT
00117 } // namespace TC
00118 
00119 
00120 #endif // _TC_MT_MESSAGE_H_

Copyright (c) Thomas Goessler 2003 - 2008