RMsgQueue Class Reference

#include <e32msgqueue.h>

class RMsgQueue : public RMsgQueueBase

Inherits from

Public Member Functions
TInt CreateGlobal(const TDesC &, TInt, TOwnerType)
TInt CreateLocal(TInt, TOwnerType)
TInt Receive(T &)
voidReceiveBlocking(T &)
TInt Send(const T &)
voidSendBlocking(const T &)
Inherited Attributes
RHandleBase::iHandle
Inherited Enumerations
RHandleBase:TAttributes
RMsgQueueBase:@277
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::Close()
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RHandleBase::SetReturnedHandle(TInt)
RHandleBase::SetReturnedHandle(TInt,RHandleBase &)
RMsgQueueBase::CancelDataAvailable()
RMsgQueueBase::CancelSpaceAvailable()
RMsgQueueBase::CreateGlobal(const TDesC &,TInt,TInt,TOwnerType)
RMsgQueueBase::CreateLocal(TInt,TInt,TOwnerType)
RMsgQueueBase::MessageSize()
RMsgQueueBase::NotifyDataAvailable(TRequestStatus &)
RMsgQueueBase::NotifySpaceAvailable(TRequestStatus &)
RMsgQueueBase::Open(RMessagePtr2,TInt,TOwnerType)
RMsgQueueBase::Open(TInt,TOwnerType)
RMsgQueueBase::OpenGlobal(const TDesC &,TOwnerType)
RMsgQueueBase::Receive(TAny *,TInt)
RMsgQueueBase::ReceiveBlocking(TAny *,TInt)
RMsgQueueBase::Send(const TAny *,TInt)
RMsgQueueBase::SendBlocking(const TAny *,TInt)

Detailed Description

A handle to a message queue.

The templated class provides the behaviour for managing an asynchronous queue of messages, where the template parameter defines the message type.

The class adds a type-checking interface to the basic message queue functionality provided by RMsgQueueBase.

Member Function Documentation

CreateGlobal ( const TDesC &, TInt, TOwnerType )

TInt CreateGlobal(const TDesC &aName,
TIntaSize,
TOwnerTypeaType = EOwnerProcess
)[inline]

Creates a global message queue, and opens a handle to that message queue.

If the name is non-empty, the message queue is visible to all processes. If the name is empty it cannot be opened or searched for by name, but a handle to it can be passed to another process as a process parameter or via IPC.

The size of each message in the queue is the size of the template parameter type. This must conform to the restrictions imposed on the aMsgLength parameter passed to the base class function RMsgQueueBase::CreateGlobal().

See also: RMsgQueueBase::CreateGlobal KMaxLength

Parameters
aNameThe name to be assigned to the message queue.
aSizeThe number of message 'slots' in the queue. This must be a positive value, i.e. greater than zero.
aTypeThe type of handle to be created. EOwnerProcess is the default value, if not explicitly specified.
Return Value
KErrNone if the queue is created sucessfully, otherwise one of the other system wide error codes.
Panic Codes
KERN-EXEC49 if aSize is less than or equal to zero.
KERN-EXEC48 if the size of the template parameter type is not a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.

CreateLocal ( TInt, TOwnerType )

TInt CreateLocal(TIntaSize,
TOwnerTypeaType = EOwnerProcess
)[inline]

Creates a message queue that is private to the current process, and opens a handle to that message queue.

The size of each message in the queue is the size of the template parameter type. This must conform to the restrictions imposed on the aMsgLength parameter passed to the base class function RMsgQueueBase::CreateLocal().

See also: RMsgQueueBase::CreateLocal KMaxLength

Parameters
aSizeThe number of message 'slots' in the queue. This must be a positive value, i.e. greater than zero.
aTypeThe type of handle to be created. EOwnerProcess is the default value, if not explicitly specified.
Return Value
KErrNone if the queue is created sucessfully, otherwise one of the other system wide error codes.
Panic Codes
KERN-EXEC49 if aSize is less than or equal to zero.
KERN-EXEC48 if the size of the template parameter type is not a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.

Receive ( T & )

TInt Receive(T &aMsg)[inline]

Retrieves the first message in the queue.

The function does not wait (i.e. block), if the queue is empty.

The function is implemented through a call to RMsgQueueBase::Receive().

See also: RMsgQueueBase::Receive

Parameters
aMsgThe object into which the message is retrieved.
Return Value
KErrNone, ifsuccessful; KErrUnderflow, if the queue is empty.

ReceiveBlocking ( T & )

voidReceiveBlocking(T &aMsg)[inline]

Retrieves the first message in the queue, and waits if the queue is empty.

The function uses NotifyDataAvailable() to provide the blocking operation. Note it is not possible to cancel a call to ReceiveBlocking().

The function is implemented through a call to RMsgQueueBase::ReceiveBlocking().

See also: RMsgQueueBase::ReceiveBlocking

Parameters
aMsgThe object into which the message is retrieved.

Send ( const T & )

TInt Send(const T &aMsg)[inline]

Sends a message through this queue.

The function does not wait (i.e. block), if the queue is full.

The function is implemented through a call to RMsgQueueBase::Send().

See also: RMsgQueueBase::Send

Parameters
aMsgThe message data to be sent.
Return Value
KErrNone, if successful; KErrOverflow, if queue is full,

SendBlocking ( const T & )

voidSendBlocking(const T &aMsg)[inline]

Sends a message through this queue, and waits for space to become available if the queue is full.

The function uses NotifySpaceAvailable() to provide the blocking operation. Note that it is not possible to cancel a call to SendBlocking().

The function is implemented through a call to RMsgQueueBase::SendBlocking().

See also: RMsgQueueBase::SendBlocking

Parameters
aMsgThe message data to be sent.