epoc32/include/e32msgqueue.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/e32msgqueue.inl	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/e32msgqueue.inl	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,172 @@
     1.4 -e32msgqueue.inl
     1.5 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// e32/include/e32msgqueue.inl
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +template <typename T>
    1.26 +inline TInt RMsgQueue<T>::CreateLocal(TInt aSize, TOwnerType aOwner)
    1.27 +/**
    1.28 +Creates a message queue that is private to the current process,
    1.29 +and opens a handle to that message queue.
    1.30 +
    1.31 +The size of each message in the queue is the size of the template
    1.32 +parameter type. 
    1.33 +This must conform to the restrictions imposed on the aMsgLength parameter
    1.34 +passed to the base class function RMsgQueueBase::CreateLocal().
    1.35 +
    1.36 +@param aSize      The number of message 'slots' in the queue.
    1.37 +                  This must be a positive value, i.e. greater than zero.
    1.38 +@param aOwner     The type of handle to be created.
    1.39 +                  EOwnerProcess is the default value, if not explicitly specified.
    1.40 +
    1.41 +@return KErrNone if the queue is created sucessfully, otherwise one of
    1.42 +        the other system wide error codes.
    1.43 +
    1.44 +@panic KERN-EXEC 49 if aSize is less than or equal to zero.
    1.45 +@panic KERN-EXEC 48 if the size of the template parameter type is not
    1.46 +       a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.
    1.47 +
    1.48 +@see RMsgQueueBase::CreateLocal
    1.49 +@see KMaxLength
    1.50 +*/
    1.51 +	{return RMsgQueueBase::CreateLocal(aSize, sizeof(T), aOwner);}
    1.52 +
    1.53 +
    1.54 +
    1.55 +
    1.56 +template <typename T>
    1.57 +inline TInt RMsgQueue<T>::CreateGlobal(const TDesC& aName, TInt aSize, TOwnerType aOwner)
    1.58 +/**
    1.59 +Creates a global message queue, and opens a handle to that
    1.60 +message queue.
    1.61 +
    1.62 +If the name is non-empty, the message queue is visible to all processes.
    1.63 +If the name is empty it cannot be opened or searched for by name, but a handle
    1.64 +to it can be passed to another process as a process parameter or via IPC.
    1.65 +
    1.66 +The size of each message in the queue is the size of the template
    1.67 +parameter type. 
    1.68 +This must conform to the restrictions imposed on the aMsgLength parameter
    1.69 +passed to the base class function RMsgQueueBase::CreateGlobal().
    1.70 +
    1.71 +@param aName  The name to be assigned to the message queue.
    1.72 +@param aSize  The number of message 'slots' in the queue.
    1.73 +              This must be a positive value, i.e. greater than zero.
    1.74 +@param aOwner The type of handle to be created.
    1.75 +              EOwnerProcess is the default value, if not explicitly specified.
    1.76 +
    1.77 +@return KErrNone if the queue is created sucessfully, otherwise one of
    1.78 +        the other system wide error codes.
    1.79 +
    1.80 +@panic KERN-EXEC 49 if aSize is less than or equal to zero.
    1.81 +@panic KERN-EXEC 48 if the size of the template parameter type is not
    1.82 +       a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.
    1.83 +
    1.84 +@see RMsgQueueBase::CreateGlobal
    1.85 +@see KMaxLength
    1.86 +*/
    1.87 +	{return RMsgQueueBase::CreateGlobal(aName, aSize, sizeof(T), aOwner);}
    1.88 +
    1.89 +
    1.90 +
    1.91 +
    1.92 +//realtime
    1.93 +template <typename T>
    1.94 +inline TInt RMsgQueue<T>::Send(const T& aMessage)
    1.95 +/**
    1.96 +
    1.97 +Sends a message through this queue.
    1.98 +
    1.99 +The function does not wait (i.e. block), if the queue is full.
   1.100 +
   1.101 +The function is implemented through a call to 
   1.102 +RMsgQueueBase::Send().
   1.103 +  
   1.104 +@param aMessage The message data to be sent.
   1.105 +
   1.106 +@return KErrNone, if successful;
   1.107 +        KErrOverflow, if queue is full,
   1.108 +
   1.109 +@see RMsgQueueBase::Send
   1.110 +*/
   1.111 +	{return RMsgQueueBase::Send(&aMessage, sizeof(T));}
   1.112 +
   1.113 +
   1.114 +
   1.115 +
   1.116 +template <typename T>
   1.117 +inline void RMsgQueue<T>::SendBlocking(const T& aMessage)
   1.118 +/**
   1.119 +Sends a message through this queue, and waits for space to become available 
   1.120 +if the queue is full.
   1.121 +
   1.122 +The function uses NotifySpaceAvailable() to provide the blocking operation. 
   1.123 +Note that it is not possible to cancel a call to SendBlocking().
   1.124 +
   1.125 +The function is implemented through a call to 
   1.126 +RMsgQueueBase::SendBlocking().
   1.127 +
   1.128 +@param aMessage The message data to be sent.
   1.129 +
   1.130 +@see RMsgQueueBase::SendBlocking
   1.131 +*/
   1.132 +	{RMsgQueueBase::SendBlocking(&aMessage, sizeof(T));}
   1.133 +
   1.134 +
   1.135 +
   1.136 +
   1.137 +//realtime
   1.138 +template <typename T>
   1.139 +inline TInt RMsgQueue<T>::Receive(T& aMessage)
   1.140 +/**
   1.141 +
   1.142 +Retrieves the first message in the queue.
   1.143 +
   1.144 +The function does not wait (i.e. block), if the queue is empty.
   1.145 +
   1.146 +The function is implemented through a call to 
   1.147 +RMsgQueueBase::Receive().
   1.148 +
   1.149 +@param aMessage The object into which the message is retrieved.
   1.150 +
   1.151 +@return KErrNone, ifsuccessful;
   1.152 +        KErrUnderflow, if the queue is empty.
   1.153 +
   1.154 +@see RMsgQueueBase::Receive
   1.155 +*/
   1.156 +	{return RMsgQueueBase::Receive(&aMessage, sizeof(T));}
   1.157 +
   1.158 +
   1.159 +
   1.160 +
   1.161 +template <typename T>
   1.162 +inline void RMsgQueue<T>::ReceiveBlocking(T& aMessage)
   1.163 +/**
   1.164 +Retrieves the first message in the queue, and waits if the queue is empty.
   1.165 +
   1.166 +The function uses NotifyDataAvailable() to provide the blocking operation.
   1.167 +Note it is not possible to cancel a call to ReceiveBlocking().
   1.168 +
   1.169 +The function is implemented through a call to 
   1.170 +RMsgQueueBase::ReceiveBlocking().
   1.171 +
   1.172 +@param aMessage The object into which the message is retrieved.
   1.173 +	
   1.174 +@see RMsgQueueBase::ReceiveBlocking
   1.175 +*/
   1.176 +	{RMsgQueueBase::ReceiveBlocking(&aMessage, sizeof(T));}