1 /* 2 * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold (bonefish@users.sf.net) 7 */ 8 #ifndef _MESSENGER_H 9 #define _MESSENGER_H 10 11 12 #include <OS.h> 13 #include <ByteOrder.h> 14 #include <Message.h> 15 16 class BHandler; 17 class BLooper; 18 19 20 class BMessenger { 21 public: 22 BMessenger(); 23 BMessenger(const BMessenger &from); 24 ~BMessenger(); 25 26 // Operators and misc 27 28 BMessenger &operator=(const BMessenger &from); 29 bool operator==(const BMessenger &other) const; 30 31 bool IsValid() const; 32 team_id Team() const; 33 34 //----- Private or reserved ----------------------------------------- 35 36 class Private; 37 38 private: 39 friend class Private; 40 41 void _SetTo(team_id team, port_id port, int32 token); 42 43 private: 44 port_id fPort; 45 int32 fHandlerToken; 46 team_id fTeam; 47 48 int32 _reserved[3]; 49 }; 50 51 bool operator<(const BMessenger &a, const BMessenger &b); 52 bool operator!=(const BMessenger &a, const BMessenger &b); 53 54 #endif // _MESSENGER_H 55