197398464SJohn Scipione/* 297398464SJohn Scipione * Copyright 2001-2015 Haiku, Inc. All rights reserved. 397398464SJohn Scipione * Distributed under the terms of the MIT License. 497398464SJohn Scipione * 597398464SJohn Scipione * Authors: 697398464SJohn Scipione * John Scipione, jscipione@gmail.com 797398464SJohn Scipione * Ingo Weinhold, bonefish@users.sf.net 897398464SJohn Scipione * 997398464SJohn Scipione * Corresponds to: 1097398464SJohn Scipione * headers/os/app/Messenger.h hrev48689 1197398464SJohn Scipione * src/kits/app/Messenger.cpp hrev48689 1297398464SJohn Scipione */ 1397398464SJohn Scipione 1497398464SJohn Scipione 1597398464SJohn Scipione/*! 1697398464SJohn Scipione \file Messenger.h 1797398464SJohn Scipione \ingroup app 1897398464SJohn Scipione \ingroup libbe 19fd3c25a9SJohn Scipione \brief Provides the BMessenger class and some BMessenger operator 20fd3c25a9SJohn Scipione functions. 2197398464SJohn Scipione*/ 2297398464SJohn Scipione 2397398464SJohn Scipione 2497398464SJohn Scipione/*! 2597398464SJohn Scipione \class BMessenger 2697398464SJohn Scipione \ingroup app 2797398464SJohn Scipione \ingroup libbe 2897398464SJohn Scipione \brief A class to send messages to a target BLooper or BHandler. 2997398464SJohn Scipione 3097398464SJohn Scipione A BMessenger can send messages to local and remote targets. If the target 3197398464SJohn Scipione belongs to the same team as the BMessenger it is a local target, otherwise 3297398464SJohn Scipione if the target lives in a separate address space it is a remote target. 3397398464SJohn Scipione 3497398464SJohn Scipione The most significant (set of) method(s) in the class is SendMessage(), 3597398464SJohn Scipione which sends its message to the target. For a local target SendMessage() 3697398464SJohn Scipione is roughly equivalent in terms of efficiency to posting a message 37*2eb2dcfaSJohn Scipione directly to the messenger's target (i.e. BLooper::PostMessage()). 3897398464SJohn Scipione 3997398464SJohn Scipione The global \a be_app_messenger pointer targets the main message 4097398464SJohn Scipione loop of \a be_app is automatically initialized for you when you create 4197398464SJohn Scipione a BApplication object, you can use it wherever a BMessenger is called for. 4297398464SJohn Scipione 4397398464SJohn Scipione \since BeOS R3 4497398464SJohn Scipione*/ 4597398464SJohn Scipione 4697398464SJohn Scipione 4797398464SJohn Scipione/*! 4897398464SJohn Scipione \fn BMessenger::BMessenger() 4997398464SJohn Scipione \brief Creates an uninitialized BMessenger. 5097398464SJohn Scipione 5197398464SJohn Scipione \since BeOS R3 5297398464SJohn Scipione*/ 5397398464SJohn Scipione 5497398464SJohn Scipione 5597398464SJohn Scipione/*! 5697398464SJohn Scipione \fn BMessenger::BMessenger(const char* signature, team_id team, 5797398464SJohn Scipione status_t* result) 5897398464SJohn Scipione \brief Creates a BMessenger and initializes it to target the already 5997398464SJohn Scipione running application identified by its signature and/or team ID. 6097398464SJohn Scipione 6197398464SJohn Scipione When only a \a signature is given, and multiple instances of the application 6297398464SJohn Scipione are running it is indeterminate which one is chosen as the target. In case 6397398464SJohn Scipione only a \a team ID is passed, the target application is identified uniquely. 6497398464SJohn Scipione If both are supplied, the application identified by the \a team ID must have 6597398464SJohn Scipione a matching signature, otherwise the initialization fails. 6697398464SJohn Scipione 6797398464SJohn Scipione \param signature The target application's signature. May be \c NULL. 6897398464SJohn Scipione \param team The target application's team ID. May be < 0. 6997398464SJohn Scipione \param result An optional pointer to a pre-allocated status_t into which 7097398464SJohn Scipione the result of the initialization is written. 7197398464SJohn Scipione 7297398464SJohn Scipione \since BeOS R3 7397398464SJohn Scipione*/ 7497398464SJohn Scipione 7597398464SJohn Scipione 7697398464SJohn Scipione/*! 7797398464SJohn Scipione \fn BMessenger::BMessenger(const BHandler* handler, const BLooper* looper, 7897398464SJohn Scipione status_t* _result) 7997398464SJohn Scipione \brief Creates a BMessenger and initializes it to target the local 8097398464SJohn Scipione BHandler and/or BLooper. 8197398464SJohn Scipione 8297398464SJohn Scipione When a \c NULL \a handler is supplied, the preferred handler in the 8397398464SJohn Scipione \a looper is targeted. If no \a looper is supplied the looper that \a handler 8497398464SJohn Scipione belongs to is used instead -- that means in particular, that the \a handler 8597398464SJohn Scipione must already belong to a looper. If both are supplied the \a handler must 8697398464SJohn Scipione belong to the \a looper. 8797398464SJohn Scipione 8897398464SJohn Scipione \param handler The target handler. May be \c NULL. 8997398464SJohn Scipione \param looper The target looper. May be \c NULL. 9097398464SJohn Scipione \param _result An optional pointer to a pre-allocated status_t into which 9197398464SJohn Scipione the result of the initialization is written. 9297398464SJohn Scipione 9397398464SJohn Scipione \since BeOS R3 9497398464SJohn Scipione*/ 9597398464SJohn Scipione 9697398464SJohn Scipione 9797398464SJohn Scipione/*! 9897398464SJohn Scipione \fn BMessenger::BMessenger(const BMessenger& other) 9997398464SJohn Scipione \brief Creates a BMessenger and initializes it to have the same target 10097398464SJohn Scipione as the supplied messenger. 10197398464SJohn Scipione 10297398464SJohn Scipione \since BeOS R3 10397398464SJohn Scipione*/ 10497398464SJohn Scipione 10597398464SJohn Scipione 10697398464SJohn Scipione/*! 10797398464SJohn Scipione \fn BMessenger::~BMessenger() 10897398464SJohn Scipione \brief Frees all resources associated with this object. 10997398464SJohn Scipione 11097398464SJohn Scipione \since BeOS R3 11197398464SJohn Scipione*/ 11297398464SJohn Scipione 11397398464SJohn Scipione 11497398464SJohn Scipione/*! 11597398464SJohn Scipione \name Target 11697398464SJohn Scipione*/ 11797398464SJohn Scipione 11897398464SJohn Scipione 11997398464SJohn Scipione//! @{ 12097398464SJohn Scipione 12197398464SJohn Scipione 12297398464SJohn Scipione/*! 12397398464SJohn Scipione \fn bool BMessenger::IsTargetLocal() const 12497398464SJohn Scipione \brief Returns whether the messenger and target belong to the same team. 12597398464SJohn Scipione 12697398464SJohn Scipione \return \c true if the messenger is properly initialized and its target 12797398464SJohn Scipione belong ot the same team, \c false if they reside in separate 12897398464SJohn Scipione address spaces. 12997398464SJohn Scipione 13097398464SJohn Scipione \since BeOS R3 13197398464SJohn Scipione*/ 13297398464SJohn Scipione 13397398464SJohn Scipione 13497398464SJohn Scipione 13597398464SJohn Scipione/*! 13697398464SJohn Scipione \fn BHandler* BMessenger::Target(BLooper** _looper) const 13797398464SJohn Scipione \brief Returns the handler and looper targeted by the messenger 13897398464SJohn Scipione (if the target is local). 13997398464SJohn Scipione 14097398464SJohn Scipione The handler is returned directly, the looper by reference. If both are 14197398464SJohn Scipione \c NULL, the object is either not properly initialized, the target 14297398464SJohn Scipione objects have been deleted or the target is remote. If only the returned 14397398464SJohn Scipione handler is \c NULL, either the looper's preferred handler is targeted or 14497398464SJohn Scipione the handler has been deleted. 14597398464SJohn Scipione 14697398464SJohn Scipione \param _looper A pointer to a pre-allocated BLooper pointer into which 14797398464SJohn Scipione the pointer to the targeted looper is written. 14897398464SJohn Scipione 14997398464SJohn Scipione \return The BHandler targeted by the messenger. 15097398464SJohn Scipione 15197398464SJohn Scipione \since BeOS R3 15297398464SJohn Scipione*/ 15397398464SJohn Scipione 15497398464SJohn Scipione 15597398464SJohn Scipione/*! 15697398464SJohn Scipione \fn bool BMessenger::LockTarget() const 15797398464SJohn Scipione \brief Locks the BLooper targeted by the messenger 15897398464SJohn Scipione (if the target is local). 15997398464SJohn Scipione 16097398464SJohn Scipione This method is a shorthand for retrieving the targeted looper via 16197398464SJohn Scipione Target() and calling BLooper::Lock() on the looper afterwards. 16297398464SJohn Scipione 16397398464SJohn Scipione \see BLooper::Lock() for details. 16497398464SJohn Scipione 16597398464SJohn Scipione \return \c true, if the looper was locked successfully, \c false, if 16697398464SJohn Scipione the messenger was not properly initialized, the target was remote, 16797398464SJohn Scipione or the targeted looper was invalid. 16897398464SJohn Scipione 16997398464SJohn Scipione \since BeOS R3 17097398464SJohn Scipione*/ 17197398464SJohn Scipione 17297398464SJohn Scipione 17397398464SJohn Scipione 17497398464SJohn Scipione/*! 17597398464SJohn Scipione \fn status_t BMessenger::LockTargetWithTimeout(bigtime_t timeout) const 17697398464SJohn Scipione \brief Locks the BLooper targeted by the messenger with a \a timeout 17797398464SJohn Scipione (if the target is local). 17897398464SJohn Scipione 17997398464SJohn Scipione This method is a shorthand for retrieving the targeted looper via 18097398464SJohn Scipione Target() and calling BLooper::LockWithTimeout() on the looper afterwards. 18197398464SJohn Scipione 18297398464SJohn Scipione \see BLooper::LockWithTimeout() for details. 18397398464SJohn Scipione 18497398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise, 18597398464SJohn Scipione all other error codes returned by BLooper::LockWithTimeout(). 18697398464SJohn Scipione \retval B_OK if the looper could be locked successfully, 18797398464SJohn Scipione \retval B_BAD_VALUE if the messenger is not properly initialized, 18897398464SJohn Scipione the target is remote, or the targeted looper is invalid. 18997398464SJohn Scipione 19097398464SJohn Scipione \see BLooper::LockWithTimeout() for more error codes. 19197398464SJohn Scipione 19297398464SJohn Scipione \since BeOS R3 19397398464SJohn Scipione*/ 19497398464SJohn Scipione 19597398464SJohn Scipione 19697398464SJohn Scipione//! @} 19797398464SJohn Scipione 19897398464SJohn Scipione 19997398464SJohn Scipione/*! 20097398464SJohn Scipione \name SendMessage 20197398464SJohn Scipione*/ 20297398464SJohn Scipione 20397398464SJohn Scipione 20497398464SJohn Scipione//! @{ 20597398464SJohn Scipione 20697398464SJohn Scipione 20797398464SJohn Scipione/*! 20897398464SJohn Scipione \fn status_t BMessenger::SendMessage(uint32 command, BHandler* replyTo) const 20997398464SJohn Scipione \brief Delivers a BMessage with a \c what parameter set to \a command 21097398464SJohn Scipione synchronously to the messenger's target, without waiting for a reply. 21197398464SJohn Scipione 21297398464SJohn Scipione If the target's message port is full, the method waits indefinitely, until 21397398464SJohn Scipione space becomes available in the port. After delivery the method returns 21497398464SJohn Scipione immediately. It does not wait until the target processes the message or 21597398464SJohn Scipione even sends a reply. 21697398464SJohn Scipione 21797398464SJohn Scipione \param command The what field of the message to deliver. 21897398464SJohn Scipione \param replyTo The handler to which a reply to the message shall be sent. 21997398464SJohn Scipione May be \c NULL. 22097398464SJohn Scipione 22197398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise. 22297398464SJohn Scipione \retval B_OK Everything went fine. 22397398464SJohn Scipione \retval B_BAD_PORT_ID The messenger is not properly initialized or its 22497398464SJohn Scipione target doesn't exist anymore. 22597398464SJohn Scipione 22697398464SJohn Scipione \since BeOS R3 22797398464SJohn Scipione*/ 22897398464SJohn Scipione 22997398464SJohn Scipione 23097398464SJohn Scipione/*! 23197398464SJohn Scipione \fn status_t BMessenger::SendMessage(BMessage* message, BHandler* replyTo, 23297398464SJohn Scipione bigtime_t timeout) const 23397398464SJohn Scipione \brief Delivers a BMessage synchronously to the messenger's target, 23497398464SJohn Scipione without waiting for a reply. 23597398464SJohn Scipione 23697398464SJohn Scipione A copy of the supplied message is sent and the caller retains ownership 23797398464SJohn Scipione of \a message. 23897398464SJohn Scipione 23997398464SJohn Scipione If the target's message port is full, the method waits until space becomes 24097398464SJohn Scipione available in the port or the specified timeout occurs (whichever happens 24197398464SJohn Scipione first). After delivery the method returns immediately. It does not wait 24297398464SJohn Scipione until the target processes the message or even sends a reply. 24397398464SJohn Scipione 24497398464SJohn Scipione \param message The message to be sent. 24597398464SJohn Scipione \param replyTo The handler to which a reply to the message shall be sent. 24697398464SJohn Scipione May be \c NULL. 24797398464SJohn Scipione \param timeout A timeout for the delivery of the message. 24897398464SJohn Scipione 24997398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise. 25097398464SJohn Scipione \retval B_OK Everything went fine. 25197398464SJohn Scipione \retval B_BAD_PORT_ID The messenger was not properly initialized or its 25297398464SJohn Scipione target didn't exist. 25397398464SJohn Scipione \retval B_WOULD_BLOCK A delivery timeout of 0 was supplied and the target 25497398464SJohn Scipione port was full when trying to deliver the message. 25597398464SJohn Scipione \retval B_TIMED_OUT The timeout expired while trying to deliver the 25697398464SJohn Scipione message. 25797398464SJohn Scipione 25897398464SJohn Scipione \since BeOS R3 25997398464SJohn Scipione*/ 26097398464SJohn Scipione 26197398464SJohn Scipione 26297398464SJohn Scipione/*! 26397398464SJohn Scipione \fn status_t BMessenger::SendMessage(BMessage* message, BMessenger replyTo, 26497398464SJohn Scipione bigtime_t timeout) const 26597398464SJohn Scipione \brief Delivers a BMessage synchronously to the messenger's target, 26697398464SJohn Scipione without waiting for a reply. 26797398464SJohn Scipione 26897398464SJohn Scipione A copy of the supplied message is sent and the caller retains ownership 26997398464SJohn Scipione of \a message. 27097398464SJohn Scipione 27197398464SJohn Scipione If the target's message port is full, the method waits until space becomes 27297398464SJohn Scipione available in the port or the specified timeout occurs (whichever happens 27397398464SJohn Scipione first). After delivery the method returns immediately. It does not wait 27497398464SJohn Scipione until the target processes the message or even sends a reply. 27597398464SJohn Scipione 27697398464SJohn Scipione \param message The message to be sent. 27797398464SJohn Scipione \param replyTo A messenger specifying the target for a reply to \a message. 27897398464SJohn Scipione \param timeout A timeout for the delivery of the message. 27997398464SJohn Scipione 28097398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise. 28197398464SJohn Scipione \retval B_OK Everything went fine. 28297398464SJohn Scipione \retval B_BAD_PORT_ID The messenger was not properly initialized or its 28397398464SJohn Scipione target didn't exist. 28497398464SJohn Scipione \retval B_WOULD_BLOCK A delivery timeout of 0 was supplied and the target 28597398464SJohn Scipione port was full when trying to deliver the message. 28697398464SJohn Scipione \retval B_TIMED_OUT The timeout expired while trying to deliver the 28797398464SJohn Scipione message. 28897398464SJohn Scipione 28997398464SJohn Scipione \since BeOS R4 29097398464SJohn Scipione*/ 29197398464SJohn Scipione 29297398464SJohn Scipione 29397398464SJohn Scipione/*! 29497398464SJohn Scipione \fn status_t BMessenger::SendMessage(uint32 command, BMessage* reply) const 29597398464SJohn Scipione \brief Delivers a BMessage with a \c what parameter set to \a command 29697398464SJohn Scipione synchronously to the messenger's target and waits for a reply. 29797398464SJohn Scipione 29897398464SJohn Scipione The method does wait for a reply. The reply message is copied into 29997398464SJohn Scipione \a reply. If the target doesn't send a reply, the \c what field of 30097398464SJohn Scipione \a reply is set to \c B_NO_REPLY. 30197398464SJohn Scipione 30297398464SJohn Scipione \param command The what field of the message to deliver. 30397398464SJohn Scipione \param reply A pointer to a pre-allocated BMessage into which the reply 30497398464SJohn Scipione message will be copied. 30597398464SJohn Scipione 30697398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise. 30797398464SJohn Scipione \retval B_OK Everything went fine. 30897398464SJohn Scipione \retval B_BAD_PORT_ID The messenger was not properly initialized or its 30997398464SJohn Scipione target didn't exist. 31097398464SJohn Scipione \retval B_NO_MORE_PORTS All reply ports were in use. 31197398464SJohn Scipione 31297398464SJohn Scipione \since BeOS R3 31397398464SJohn Scipione*/ 31497398464SJohn Scipione 31597398464SJohn Scipione 31697398464SJohn Scipione/*! 31797398464SJohn Scipione \fn status_t BMessenger::SendMessage(BMessage* message, BMessage* reply, 31897398464SJohn Scipione bigtime_t deliveryTimeout, bigtime_t replyTimeout) const 31997398464SJohn Scipione \brief Delivers a BMessage synchronously to the messenger's target and 32097398464SJohn Scipione waits for a reply. 32197398464SJohn Scipione 32297398464SJohn Scipione A copy of the supplied message is sent and the caller retains ownership 32397398464SJohn Scipione of \a message. 32497398464SJohn Scipione 32597398464SJohn Scipione The method does wait for a reply. The reply message is copied into 32697398464SJohn Scipione \a reply. If the target doesn't send a reply or if a reply timeout occurs, 32797398464SJohn Scipione the \c what field of \a reply is set to \c B_NO_REPLY. 32897398464SJohn Scipione 32997398464SJohn Scipione \param message The message to be sent. 33097398464SJohn Scipione \param reply A pointer to a pre-allocated BMessage into which the reply 33197398464SJohn Scipione message will be copied. 33297398464SJohn Scipione \param deliveryTimeout A timeout for the delivery of the message. 33397398464SJohn Scipione \param replyTimeout A timeout for waiting for the reply. 33497398464SJohn Scipione 33597398464SJohn Scipione \return A status code, \c B_OK on success or an error code otherwise. 33697398464SJohn Scipione \retval B_OK Everything went fine. 33797398464SJohn Scipione \retval B_BAD_PORT_ID The messenger was not properly initialized or its 33897398464SJohn Scipione target didn't exist. 33997398464SJohn Scipione \retval B_WOULD_BLOCK A delivery timeout of 0 was supplied and the target 34097398464SJohn Scipione port was full when trying to deliver the message. 34197398464SJohn Scipione \retval B_TIMED_OUT The timeout expired while trying to deliver the 34297398464SJohn Scipione message. 34397398464SJohn Scipione \retval B_NO_MORE_PORTS All reply ports were in use. 34497398464SJohn Scipione 34597398464SJohn Scipione \since BeOS R3 34697398464SJohn Scipione*/ 34797398464SJohn Scipione 34897398464SJohn Scipione 34997398464SJohn Scipione//! @} 35097398464SJohn Scipione 35197398464SJohn Scipione 35297398464SJohn Scipione/*! 35397398464SJohn Scipione \name SetTo 35497398464SJohn Scipione*/ 35597398464SJohn Scipione 35697398464SJohn Scipione 35797398464SJohn Scipione//! @{ 35897398464SJohn Scipione 35997398464SJohn Scipione 36097398464SJohn Scipione/*! 36197398464SJohn Scipione \fn status_t BMessenger::SetTo(const char* signature, team_id team) 36297398464SJohn Scipione \brief Reinitializes a BMessenger to target the already running application 36397398464SJohn Scipione identified by the supplied signature and/or team ID. 36497398464SJohn Scipione 36597398464SJohn Scipione When only a signature is given, and multiple instances of the application 36697398464SJohn Scipione are running it is indeterminate which one is chosen as the target. In case 36797398464SJohn Scipione only a team ID is passed, the target application is identified uniquely. 36897398464SJohn Scipione If both are supplied, the application identified by the team ID must have 36997398464SJohn Scipione a matching signature, otherwise the initialization fails. 37097398464SJohn Scipione 37197398464SJohn Scipione \param signature The target application's signature. May be \c NULL. 37297398464SJohn Scipione \param team The target application's team ID. May be negative. 37397398464SJohn Scipione 37497398464SJohn Scipione \return A status code, \c B_OK if the reinitialization was successful or an 37597398464SJohn Scipione error code otherwise. 37697398464SJohn Scipione \retval B_OK The reinitialization was successful. 37797398464SJohn Scipione \retval B_BAD_VALUE No application with the given \a signature or \a team 37897398464SJohn Scipione ID was running. 37997398464SJohn Scipione \retval B_BAD_TYPE No \a team ID was given and the \a signature was \c NULL. 38097398464SJohn Scipione \retval B_MISMATCHED_VALUES The supplied \a signature and the signature of 38197398464SJohn Scipione the team didn't match. 38297398464SJohn Scipione 38397398464SJohn Scipione \since Haiku R1 38497398464SJohn Scipione*/ 38597398464SJohn Scipione 38697398464SJohn Scipione 38797398464SJohn Scipione/*! 38897398464SJohn Scipione \fn status_t BMessenger::SetTo(const BHandler* handler, 38997398464SJohn Scipione const BLooper* looper) 39097398464SJohn Scipione \brief Reinitializes a BMessenger to target the local BHandler and/or 39197398464SJohn Scipione BLooper. 39297398464SJohn Scipione 39397398464SJohn Scipione When a \c NULL handler is supplied, the preferred handler in the given 39497398464SJohn Scipione looper is targeted. If no looper is supplied the looper the given handler 39597398464SJohn Scipione belongs to is used -- that means in particular, that the handler must 39697398464SJohn Scipione already belong to a looper. If both are supplied the handler must actually 39797398464SJohn Scipione belong to looper. 39897398464SJohn Scipione 39997398464SJohn Scipione \param handler The target handler. May be \c NULL. 40097398464SJohn Scipione \param looper The target looper. May be \c NULL. 40197398464SJohn Scipione 40297398464SJohn Scipione \return A status code, \c B_OK if the reinitialization was successful or an 40397398464SJohn Scipione error code otherwise. 40497398464SJohn Scipione \retval B_OK The reinitialization was successful. 40597398464SJohn Scipione \retval B_BAD_VALUE Both \a handler and \a looper were \c NULL or invalid. 40697398464SJohn Scipione \retval B_MISMATCHED_VALUES The looper of the supplied \a handler and 40797398464SJohn Scipione \a looper didn't match. 40897398464SJohn Scipione 40997398464SJohn Scipione \since Haiku R1 41097398464SJohn Scipione*/ 41197398464SJohn Scipione 41297398464SJohn Scipione 41397398464SJohn Scipione//! @} 41497398464SJohn Scipione 41597398464SJohn Scipione 41697398464SJohn Scipione/*! 41797398464SJohn Scipione \name Operators 41897398464SJohn Scipione*/ 41997398464SJohn Scipione 42097398464SJohn Scipione 42197398464SJohn Scipione//! @{ 42297398464SJohn Scipione 42397398464SJohn Scipione 42497398464SJohn Scipione/*! 42597398464SJohn Scipione \fn BMessenger& BMessenger::operator=(const BMessenger& other) 42697398464SJohn Scipione \brief Assignment operator, makes this BMessenger a copy of \a other. 42797398464SJohn Scipione 42897398464SJohn Scipione \param other the messenger to be copied. 42997398464SJohn Scipione 43097398464SJohn Scipione \return A reference to this object. 43197398464SJohn Scipione 43297398464SJohn Scipione \since BeOS R3 43397398464SJohn Scipione*/ 43497398464SJohn Scipione 43597398464SJohn Scipione 43697398464SJohn Scipione/*! 43797398464SJohn Scipione \fn bool BMessenger::operator==(const BMessenger& other) const 43897398464SJohn Scipione \brief Comparison operator, returns whether this and \a other have the same 43997398464SJohn Scipione target. 44097398464SJohn Scipione 44197398464SJohn Scipione \param other The messenger to be compared to. 44297398464SJohn Scipione 44397398464SJohn Scipione \return \c true, if the messengers have the same target or if both aren't 44497398464SJohn Scipione properly initialized, \c false otherwise. 44597398464SJohn Scipione 44697398464SJohn Scipione \since BeOS R3 44797398464SJohn Scipione*/ 44897398464SJohn Scipione 44997398464SJohn Scipione 45097398464SJohn Scipione//! @} 45197398464SJohn Scipione 45297398464SJohn Scipione 45397398464SJohn Scipione/*! 45497398464SJohn Scipione \fn bool BMessenger::IsValid() const 45597398464SJohn Scipione \brief Returns whether the messenger's target looper still exists. 45697398464SJohn Scipione 45797398464SJohn Scipione \warning This method does not check whether the target handler 45897398464SJohn Scipione also still exists. 45997398464SJohn Scipione 46097398464SJohn Scipione \return \c true, if the messenger's target looper still exists, 46197398464SJohn Scipione \c false otherwise. 46297398464SJohn Scipione 46397398464SJohn Scipione \since BeOS R3 46497398464SJohn Scipione*/ 46597398464SJohn Scipione 46697398464SJohn Scipione 46797398464SJohn Scipione/*! 46897398464SJohn Scipione \fn team_id BMessenger::Team() const 46997398464SJohn Scipione \brief Returns the ID of the team that the messenger's target belongs to. 47097398464SJohn Scipione 47197398464SJohn Scipione \return The team of the messenger's target. 47297398464SJohn Scipione 47397398464SJohn Scipione \since BeOS R3 47497398464SJohn Scipione*/ 47597398464SJohn Scipione 47697398464SJohn Scipione 47797398464SJohn Scipione/*! 47897398464SJohn Scipione \fn uint32 BMessenger::HashValue() const 47997398464SJohn Scipione \brief Returns a hash value that uniquely identifies the messenger. 48097398464SJohn Scipione 48197398464SJohn Scipione \since Haiku R1 48297398464SJohn Scipione*/ 483fd3c25a9SJohn Scipione 484fd3c25a9SJohn Scipione 485fd3c25a9SJohn Scipione/*! 486fd3c25a9SJohn Scipione \fn bool operator<(const BMessenger& _a, const BMessenger& _b) 487fd3c25a9SJohn Scipione \brief Returns whether the first messenger is less than the second one. 488fd3c25a9SJohn Scipione 489fd3c25a9SJohn Scipione This method defines an order on BMessengers based on their member 490fd3c25a9SJohn Scipione variables \c fPort, \c fHandlerToken and \c fPreferredTarget. 491fd3c25a9SJohn Scipione 492fd3c25a9SJohn Scipione \param _a The first messenger. 493fd3c25a9SJohn Scipione \param _b The second messenger. 494fd3c25a9SJohn Scipione 495fd3c25a9SJohn Scipione \return \c true, if \a a was less than \a b, \c false otherwise. 496fd3c25a9SJohn Scipione*/ 497fd3c25a9SJohn Scipione 498fd3c25a9SJohn Scipione 499*2eb2dcfaSJohn Scipione/*! 500*2eb2dcfaSJohn Scipione \fn bool operator!=(const BMessenger& a, const BMessenger& b) 501fd3c25a9SJohn Scipione \brief Returns whether two BMessengers do NOT have the same target. 502fd3c25a9SJohn Scipione 503fd3c25a9SJohn Scipione \param a The first messenger. 504fd3c25a9SJohn Scipione \param b The second messenger. 505fd3c25a9SJohn Scipione 506fd3c25a9SJohn Scipione \return \c false, if \a a and \a b had the same targets or both were not 507fd3c25a9SJohn Scipione properly initialized, \c true otherwise. 508fd3c25a9SJohn Scipione*/ 509