2003-08-25 11:55:52 +04:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// MessagePrivate.h
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2005-11-20 19:24:23 +03:00
|
|
|
#ifdef USING_MESSAGE4
|
|
|
|
# include <MessagePrivate4.h>
|
|
|
|
#else
|
|
|
|
|
2003-08-25 11:55:52 +04:00
|
|
|
#ifndef MESSAGEPRIVATE_H
|
|
|
|
#define MESSAGEPRIVATE_H
|
|
|
|
|
2003-08-26 03:33:02 +04:00
|
|
|
#include <Message.h>
|
|
|
|
#include <Messenger.h>
|
|
|
|
#include <MessengerPrivate.h>
|
2005-01-29 20:44:55 +03:00
|
|
|
#include <TokenSpace.h>
|
2003-08-25 11:55:52 +04:00
|
|
|
|
2005-11-20 19:24:23 +03:00
|
|
|
class BMessage::Private {
|
2003-08-25 11:55:52 +04:00
|
|
|
public:
|
|
|
|
Private(BMessage* msg) : fMessage(msg) {;}
|
|
|
|
Private(BMessage& msg) : fMessage(&msg) {;}
|
|
|
|
|
2005-11-20 19:24:23 +03:00
|
|
|
inline void SetTarget(int32 token)
|
2003-08-25 11:55:52 +04:00
|
|
|
{
|
|
|
|
fMessage->fTarget = token;
|
2005-11-20 19:24:23 +03:00
|
|
|
fMessage->fPreferred = token == B_PREFERRED_TOKEN;
|
2003-08-25 11:55:52 +04:00
|
|
|
}
|
2005-01-28 18:05:44 +03:00
|
|
|
|
2003-08-25 11:55:52 +04:00
|
|
|
inline void SetReply(BMessenger messenger)
|
|
|
|
{
|
2003-08-26 03:33:02 +04:00
|
|
|
BMessenger::Private mp(messenger);
|
|
|
|
fMessage->fReplyTo.port = mp.Port();
|
2005-11-20 19:24:23 +03:00
|
|
|
fMessage->fReplyTo.target = mp.Token();
|
2003-08-26 03:33:02 +04:00
|
|
|
fMessage->fReplyTo.team = mp.Team();
|
|
|
|
fMessage->fReplyTo.preferred = mp.IsPreferredTarget();
|
2003-08-25 11:55:52 +04:00
|
|
|
}
|
2005-01-28 18:05:44 +03:00
|
|
|
|
2003-08-25 11:55:52 +04:00
|
|
|
inline int32 GetTarget()
|
|
|
|
{
|
|
|
|
return fMessage->fTarget;
|
|
|
|
}
|
2005-01-28 18:05:44 +03:00
|
|
|
|
2003-08-25 11:55:52 +04:00
|
|
|
inline bool UsePreferredTarget()
|
|
|
|
{
|
|
|
|
return fMessage->fPreferred;
|
|
|
|
}
|
2005-01-26 05:18:19 +03:00
|
|
|
|
|
|
|
static inline status_t SendFlattenedMessage(void *data, int32 size,
|
2005-11-20 19:24:23 +03:00
|
|
|
port_id port, int32 token, bigtime_t timeout)
|
2005-01-26 05:18:19 +03:00
|
|
|
{
|
|
|
|
return BMessage::_SendFlattenedMessage(data, size, port, token,
|
2005-11-20 19:24:23 +03:00
|
|
|
timeout);
|
2005-01-26 05:18:19 +03:00
|
|
|
}
|
|
|
|
|
2005-01-28 18:05:44 +03:00
|
|
|
static inline void StaticInit()
|
|
|
|
{
|
|
|
|
BMessage::_StaticInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void StaticCleanup()
|
|
|
|
{
|
|
|
|
BMessage::_StaticCleanup();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void StaticCacheCleanup()
|
|
|
|
{
|
|
|
|
BMessage::_StaticCacheCleanup();
|
|
|
|
}
|
|
|
|
|
2003-08-25 11:55:52 +04:00
|
|
|
private:
|
|
|
|
BMessage* fMessage;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MESSAGEPRIVATE_H
|
2005-11-20 19:24:23 +03:00
|
|
|
#endif // USING_MESSAGE4
|