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