epoc32/include/e32msgqueue.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 e32msgqueue.inl
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // 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
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32/include/e32msgqueue.inl
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 template <typename T>
       
    22 inline TInt RMsgQueue<T>::CreateLocal(TInt aSize, TOwnerType aOwner)
       
    23 /**
       
    24 Creates a message queue that is private to the current process,
       
    25 and opens a handle to that message queue.
       
    26 
       
    27 The size of each message in the queue is the size of the template
       
    28 parameter type. 
       
    29 This must conform to the restrictions imposed on the aMsgLength parameter
       
    30 passed to the base class function RMsgQueueBase::CreateLocal().
       
    31 
       
    32 @param aSize      The number of message 'slots' in the queue.
       
    33                   This must be a positive value, i.e. greater than zero.
       
    34 @param aOwner     The type of handle to be created.
       
    35                   EOwnerProcess is the default value, if not explicitly specified.
       
    36 
       
    37 @return KErrNone if the queue is created sucessfully, otherwise one of
       
    38         the other system wide error codes.
       
    39 
       
    40 @panic KERN-EXEC 49 if aSize is less than or equal to zero.
       
    41 @panic KERN-EXEC 48 if the size of the template parameter type is not
       
    42        a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.
       
    43 
       
    44 @see RMsgQueueBase::CreateLocal
       
    45 @see KMaxLength
       
    46 */
       
    47 	{return RMsgQueueBase::CreateLocal(aSize, sizeof(T), aOwner);}
       
    48 
       
    49 
       
    50 
       
    51 
       
    52 template <typename T>
       
    53 inline TInt RMsgQueue<T>::CreateGlobal(const TDesC& aName, TInt aSize, TOwnerType aOwner)
       
    54 /**
       
    55 Creates a global message queue, and opens a handle to that
       
    56 message queue.
       
    57 
       
    58 If the name is non-empty, the message queue is visible to all processes.
       
    59 If the name is empty it cannot be opened or searched for by name, but a handle
       
    60 to it can be passed to another process as a process parameter or via IPC.
       
    61 
       
    62 The size of each message in the queue is the size of the template
       
    63 parameter type. 
       
    64 This must conform to the restrictions imposed on the aMsgLength parameter
       
    65 passed to the base class function RMsgQueueBase::CreateGlobal().
       
    66 
       
    67 @param aName  The name to be assigned to the message queue.
       
    68 @param aSize  The number of message 'slots' in the queue.
       
    69               This must be a positive value, i.e. greater than zero.
       
    70 @param aOwner The type of handle to be created.
       
    71               EOwnerProcess is the default value, if not explicitly specified.
       
    72 
       
    73 @return KErrNone if the queue is created sucessfully, otherwise one of
       
    74         the other system wide error codes.
       
    75 
       
    76 @panic KERN-EXEC 49 if aSize is less than or equal to zero.
       
    77 @panic KERN-EXEC 48 if the size of the template parameter type is not
       
    78        a multiple of 4 bytes, is less than 4, or is greater than KMaxLength.
       
    79 
       
    80 @see RMsgQueueBase::CreateGlobal
       
    81 @see KMaxLength
       
    82 */
       
    83 	{return RMsgQueueBase::CreateGlobal(aName, aSize, sizeof(T), aOwner);}
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 //realtime
       
    89 template <typename T>
       
    90 inline TInt RMsgQueue<T>::Send(const T& aMessage)
       
    91 /**
       
    92 
       
    93 Sends a message through this queue.
       
    94 
       
    95 The function does not wait (i.e. block), if the queue is full.
       
    96 
       
    97 The function is implemented through a call to 
       
    98 RMsgQueueBase::Send().
       
    99   
       
   100 @param aMessage The message data to be sent.
       
   101 
       
   102 @return KErrNone, if successful;
       
   103         KErrOverflow, if queue is full,
       
   104 
       
   105 @see RMsgQueueBase::Send
       
   106 */
       
   107 	{return RMsgQueueBase::Send(&aMessage, sizeof(T));}
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 template <typename T>
       
   113 inline void RMsgQueue<T>::SendBlocking(const T& aMessage)
       
   114 /**
       
   115 Sends a message through this queue, and waits for space to become available 
       
   116 if the queue is full.
       
   117 
       
   118 The function uses NotifySpaceAvailable() to provide the blocking operation. 
       
   119 Note that it is not possible to cancel a call to SendBlocking().
       
   120 
       
   121 The function is implemented through a call to 
       
   122 RMsgQueueBase::SendBlocking().
       
   123 
       
   124 @param aMessage The message data to be sent.
       
   125 
       
   126 @see RMsgQueueBase::SendBlocking
       
   127 */
       
   128 	{RMsgQueueBase::SendBlocking(&aMessage, sizeof(T));}
       
   129 
       
   130 
       
   131 
       
   132 
       
   133 //realtime
       
   134 template <typename T>
       
   135 inline TInt RMsgQueue<T>::Receive(T& aMessage)
       
   136 /**
       
   137 
       
   138 Retrieves the first message in the queue.
       
   139 
       
   140 The function does not wait (i.e. block), if the queue is empty.
       
   141 
       
   142 The function is implemented through a call to 
       
   143 RMsgQueueBase::Receive().
       
   144 
       
   145 @param aMessage The object into which the message is retrieved.
       
   146 
       
   147 @return KErrNone, ifsuccessful;
       
   148         KErrUnderflow, if the queue is empty.
       
   149 
       
   150 @see RMsgQueueBase::Receive
       
   151 */
       
   152 	{return RMsgQueueBase::Receive(&aMessage, sizeof(T));}
       
   153 
       
   154 
       
   155 
       
   156 
       
   157 template <typename T>
       
   158 inline void RMsgQueue<T>::ReceiveBlocking(T& aMessage)
       
   159 /**
       
   160 Retrieves the first message in the queue, and waits if the queue is empty.
       
   161 
       
   162 The function uses NotifyDataAvailable() to provide the blocking operation.
       
   163 Note it is not possible to cancel a call to ReceiveBlocking().
       
   164 
       
   165 The function is implemented through a call to 
       
   166 RMsgQueueBase::ReceiveBlocking().
       
   167 
       
   168 @param aMessage The object into which the message is retrieved.
       
   169 	
       
   170 @see RMsgQueueBase::ReceiveBlocking
       
   171 */
       
   172 	{RMsgQueueBase::ReceiveBlocking(&aMessage, sizeof(T));}