williamr@2: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of the License "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // e32/include/e32msgqueue.inl williamr@2: // williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TInt RMsgQueue::CreateLocal(TInt aSize, TOwnerType aOwner) williamr@2: /** williamr@2: Creates a message queue that is private to the current process, williamr@2: and opens a handle to that message queue. williamr@2: williamr@2: The size of each message in the queue is the size of the template williamr@2: parameter type. williamr@2: This must conform to the restrictions imposed on the aMsgLength parameter williamr@2: passed to the base class function RMsgQueueBase::CreateLocal(). williamr@2: williamr@2: @param aSize The number of message 'slots' in the queue. williamr@2: This must be a positive value, i.e. greater than zero. williamr@2: @param aOwner The type of handle to be created. williamr@2: EOwnerProcess is the default value, if not explicitly specified. williamr@2: williamr@2: @return KErrNone if the queue is created sucessfully, otherwise one of williamr@2: the other system wide error codes. williamr@2: williamr@2: @panic KERN-EXEC 49 if aSize is less than or equal to zero. williamr@2: @panic KERN-EXEC 48 if the size of the template parameter type is not williamr@2: a multiple of 4 bytes, is less than 4, or is greater than KMaxLength. williamr@2: williamr@2: @see RMsgQueueBase::CreateLocal williamr@2: @see KMaxLength williamr@2: */ williamr@2: {return RMsgQueueBase::CreateLocal(aSize, sizeof(T), aOwner);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TInt RMsgQueue::CreateGlobal(const TDesC& aName, TInt aSize, TOwnerType aOwner) williamr@2: /** williamr@2: Creates a global message queue, and opens a handle to that williamr@2: message queue. williamr@2: williamr@2: If the name is non-empty, the message queue is visible to all processes. williamr@2: If the name is empty it cannot be opened or searched for by name, but a handle williamr@2: to it can be passed to another process as a process parameter or via IPC. williamr@2: williamr@2: The size of each message in the queue is the size of the template williamr@2: parameter type. williamr@2: This must conform to the restrictions imposed on the aMsgLength parameter williamr@2: passed to the base class function RMsgQueueBase::CreateGlobal(). williamr@2: williamr@2: @param aName The name to be assigned to the message queue. williamr@2: @param aSize The number of message 'slots' in the queue. williamr@2: This must be a positive value, i.e. greater than zero. williamr@2: @param aOwner The type of handle to be created. williamr@2: EOwnerProcess is the default value, if not explicitly specified. williamr@2: williamr@2: @return KErrNone if the queue is created sucessfully, otherwise one of williamr@2: the other system wide error codes. williamr@2: williamr@2: @panic KERN-EXEC 49 if aSize is less than or equal to zero. williamr@2: @panic KERN-EXEC 48 if the size of the template parameter type is not williamr@2: a multiple of 4 bytes, is less than 4, or is greater than KMaxLength. williamr@2: williamr@2: @see RMsgQueueBase::CreateGlobal williamr@2: @see KMaxLength williamr@2: */ williamr@2: {return RMsgQueueBase::CreateGlobal(aName, aSize, sizeof(T), aOwner);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: //realtime williamr@2: template williamr@2: inline TInt RMsgQueue::Send(const T& aMessage) williamr@2: /** williamr@2: williamr@2: Sends a message through this queue. williamr@2: williamr@2: The function does not wait (i.e. block), if the queue is full. williamr@2: williamr@2: The function is implemented through a call to williamr@2: RMsgQueueBase::Send(). williamr@2: williamr@2: @param aMessage The message data to be sent. williamr@2: williamr@2: @return KErrNone, if successful; williamr@2: KErrOverflow, if queue is full, williamr@2: williamr@2: @see RMsgQueueBase::Send williamr@2: */ williamr@2: {return RMsgQueueBase::Send(&aMessage, sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void RMsgQueue::SendBlocking(const T& aMessage) williamr@2: /** williamr@2: Sends a message through this queue, and waits for space to become available williamr@2: if the queue is full. williamr@2: williamr@2: The function uses NotifySpaceAvailable() to provide the blocking operation. williamr@2: Note that it is not possible to cancel a call to SendBlocking(). williamr@2: williamr@2: The function is implemented through a call to williamr@2: RMsgQueueBase::SendBlocking(). williamr@2: williamr@2: @param aMessage The message data to be sent. williamr@2: williamr@2: @see RMsgQueueBase::SendBlocking williamr@2: */ williamr@2: {RMsgQueueBase::SendBlocking(&aMessage, sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: //realtime williamr@2: template williamr@2: inline TInt RMsgQueue::Receive(T& aMessage) williamr@2: /** williamr@2: williamr@2: Retrieves the first message in the queue. williamr@2: williamr@2: The function does not wait (i.e. block), if the queue is empty. williamr@2: williamr@2: The function is implemented through a call to williamr@2: RMsgQueueBase::Receive(). williamr@2: williamr@2: @param aMessage The object into which the message is retrieved. williamr@2: williamr@2: @return KErrNone, ifsuccessful; williamr@2: KErrUnderflow, if the queue is empty. williamr@2: williamr@2: @see RMsgQueueBase::Receive williamr@2: */ williamr@2: {return RMsgQueueBase::Receive(&aMessage, sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void RMsgQueue::ReceiveBlocking(T& aMessage) williamr@2: /** williamr@2: Retrieves the first message in the queue, and waits if the queue is empty. williamr@2: williamr@2: The function uses NotifyDataAvailable() to provide the blocking operation. williamr@2: Note it is not possible to cancel a call to ReceiveBlocking(). williamr@2: williamr@2: The function is implemented through a call to williamr@2: RMsgQueueBase::ReceiveBlocking(). williamr@2: williamr@2: @param aMessage The object into which the message is retrieved. williamr@2: williamr@2: @see RMsgQueueBase::ReceiveBlocking williamr@2: */ williamr@2: {RMsgQueueBase::ReceiveBlocking(&aMessage, sizeof(T));} williamr@4: