1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: Messenger.h 23 // Author: Ingo Weinhold (bonefish@users.sf.net) 24 // Description: BMessenger delivers messages to local or remote targets. 25 //------------------------------------------------------------------------------ 26 27 #ifndef _MESSENGER_H 28 #define _MESSENGER_H 29 30 // Standard Includes ----------------------------------------------------------- 31 32 // System Includes ------------------------------------------------------------- 33 #include <BeBuild.h> 34 #include <OS.h> 35 #include <ByteOrder.h> 36 #include <Message.h> 37 38 // Project Includes ------------------------------------------------------------ 39 40 // Local Includes -------------------------------------------------------------- 41 42 // Local Defines --------------------------------------------------------------- 43 44 // Globals --------------------------------------------------------------------- 45 46 class BHandler; 47 class BLooper; 48 49 // BMessenger class ------------------------------------------------------------ 50 class BMessenger { 51 public: 52 BMessenger(); 53 BMessenger(const BMessenger &from); 54 ~BMessenger(); 55 56 // Operators and misc 57 58 BMessenger &operator=(const BMessenger &from); 59 bool operator==(const BMessenger &other) const; 60 61 bool IsValid() const; 62 team_id Team() const; 63 64 //----- Private or reserved ----------------------------------------- 65 66 class Private; 67 68 private: 69 friend class Private; 70 71 void SetTo(team_id team, port_id port, int32 token, bool preferred); 72 73 private: 74 port_id fPort; 75 int32 fHandlerToken; 76 team_id fTeam; 77 int32 extra0; 78 int32 extra1; 79 bool fPreferredTarget; 80 bool extra2; 81 bool extra3; 82 bool extra4; 83 }; 84 85 _IMPEXP_BE bool operator<(const BMessenger &a, const BMessenger &b); 86 _IMPEXP_BE bool operator!=(const BMessenger &a, const BMessenger &b); 87 88 #endif // _MESSENGER_H 89