epoc32/include/e32msgqueue.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 e32msgqueue.h
     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.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __E32MSGQUEUE_H__
       
    19 #define __E32MSGQUEUE_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 class RMsgQueueBase : public RHandleBase
       
    27 /**
       
    28 @publishedAll
       
    29 @released
       
    30 
       
    31 Provides implementation for managing an asynchronous message queue,
       
    32 and is a base class for the RMsgQueue templated class.
       
    33 
       
    34 @see RMsgQueue
       
    35 */
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	The limit for the size of an individual message.
       
    40 	*/
       
    41 	enum {KMaxLength = 256};
       
    42 
       
    43 public:
       
    44 
       
    45 	IMPORT_C TInt CreateLocal(TInt aSize, TInt aMsgLength, TOwnerType aType=EOwnerProcess);
       
    46 	IMPORT_C TInt CreateGlobal(const TDesC& aName, TInt aSize, TInt aMsgLength, TOwnerType aType=EOwnerProcess);
       
    47 	IMPORT_C TInt OpenGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess);
       
    48 	IMPORT_C TInt Open(RMessagePtr2 aMessage, TInt aParam, TOwnerType aType=EOwnerProcess);
       
    49 	IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
       
    50 	IMPORT_C TInt Send(const TAny* aPtr, TInt aLength);
       
    51 	IMPORT_C void SendBlocking(const TAny* aPtr, TInt aLength);
       
    52 	IMPORT_C TInt Receive(TAny* aPtr, TInt aLength);
       
    53 	IMPORT_C void ReceiveBlocking(TAny* aPtr, TInt aLength);
       
    54 	IMPORT_C void NotifySpaceAvailable(TRequestStatus& aStatus);
       
    55 	IMPORT_C void CancelSpaceAvailable();
       
    56 	IMPORT_C void NotifyDataAvailable(TRequestStatus& aStatus);
       
    57 	IMPORT_C void CancelDataAvailable();
       
    58 	IMPORT_C TInt MessageSize();
       
    59 	};
       
    60 
       
    61 
       
    62 
       
    63 
       
    64 /**
       
    65 @publishedAll
       
    66 @released
       
    67 
       
    68 A handle to a message queue.
       
    69 
       
    70 The templated class provides the behaviour for managing an
       
    71 asynchronous queue of messages, where the template parameter defines the
       
    72 message type.
       
    73 
       
    74 The class adds a type-checking interface to the basic message queue
       
    75 functionality provided by RMsgQueueBase.
       
    76 */
       
    77 template <typename T>
       
    78 class RMsgQueue : public RMsgQueueBase
       
    79 	{
       
    80 public:
       
    81 	TInt CreateLocal(TInt aSize, TOwnerType aType=EOwnerProcess);
       
    82 	TInt CreateGlobal(const TDesC& aName, TInt aSize, TOwnerType aType=EOwnerProcess);
       
    83 	TInt Send(const T& aMsg);
       
    84 	void SendBlocking(const T& aMsg);
       
    85 	TInt Receive(T& aMsg);
       
    86 	void ReceiveBlocking(T& aMsg);
       
    87 	};
       
    88 
       
    89 #include <e32msgqueue.inl>
       
    90 
       
    91 #endif