Added versions of the constructors that take a const BMessage& instead of a

pointer. Allows for passing a temporary object.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39472 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-11-17 23:23:09 +00:00
parent 8aabb37b49
commit e492be3195
2 changed files with 64 additions and 0 deletions

View File

@ -14,9 +14,15 @@ public:
BMessageRunner(BMessenger target,
const BMessage* message, bigtime_t interval,
int32 count = -1);
BMessageRunner(BMessenger target,
const BMessage& message, bigtime_t interval,
int32 count = -1);
BMessageRunner(BMessenger target,
const BMessage* message, bigtime_t interval,
int32 count, BMessenger replyTo);
BMessageRunner(BMessenger target,
const BMessage& message, bigtime_t interval,
int32 count, BMessenger replyTo);
virtual ~BMessageRunner();
status_t InitCheck() const;

View File

@ -47,6 +47,34 @@ BMessageRunner::BMessageRunner(BMessenger target, const BMessage* message,
}
/*! \brief Creates and initializes a new BMessageRunner.
The target for replies to the delivered message(s) is \c be_app_messenger.
The success of the initialization can (and should) be asked for via
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but
SetInterval(), SetCount() and GetInfo() will fail.
\param target Target of the message(s).
\param message The message to be sent to the target.
\param interval Period of time before the first message is sent and
between messages (if more than one shall be sent) in microseconds.
\param count Specifies how many times the message shall be sent.
A value less than \c 0 for an unlimited number of repetitions.
*/
BMessageRunner::BMessageRunner(BMessenger target, const BMessage& message,
bigtime_t interval, int32 count)
:
fToken(-1)
{
_InitData(target, &message, interval, count, be_app_messenger);
}
/*! \brief Creates and initializes a new BMessageRunner.
This constructor version additionally allows to specify the target for
@ -77,6 +105,36 @@ BMessageRunner::BMessageRunner(BMessenger target, const BMessage* message,
}
/*! \brief Creates and initializes a new BMessageRunner.
This constructor version additionally allows to specify the target for
replies to the delivered message(s).
The success of the initialization can (and should) be asked for via
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but
SetInterval(), SetCount() and GetInfo() will fail.
\param target Target of the message(s).
\param message The message to be sent to the target.
\param interval Period of time before the first message is sent and
between messages (if more than one shall be sent) in microseconds.
\param count Specifies how many times the message shall be sent.
A value less than \c 0 for an unlimited number of repetitions.
\param replyTo Target replies to the delivered message(s) shall be sent to.
*/
BMessageRunner::BMessageRunner(BMessenger target, const BMessage& message,
bigtime_t interval, int32 count, BMessenger replyTo)
:
fToken(-1)
{
_InitData(target, &message, interval, count, replyTo);
}
/*! \brief Frees all resources associated with the object.
*/
BMessageRunner::~BMessageRunner()