os/kernelhwsrv/kerneltest/f32test/concur/cfafshmem.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1997-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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // /os/kernelhwsrv/kerneltest/f32test/concur/cfafshmem.h
    15 // 
    16 //
    17 
    18 #ifndef __CFAFSHMEM_H__
    19 #define __CFAFSHMEM_H__
    20 
    21 #include <f32file.h>
    22 #include <d32locd.h>
    23 #include <e32test.h>
    24 #include "t_server.h"
    25 
    26 const TInt KNoMessage = 0;
    27 const TInt KNoOffset = 0;
    28 
    29 class THMem
    30 /**
    31  * Memory base class.
    32  */
    33     {
    34     private:
    35         /// Copy constructor and assignment operator shall not be implemented.
    36         THMem(const THMem&);
    37         THMem& operator=(const THMem&);
    38 
    39     public:
    40         THMem(void * aNewMemPtr);
    41         THMem(const void * aNewMemPtr, const RMessagePtr2 &aMessage, int aNewOffset=0);
    42         TInt Read(void *aBuf, TUint32 aLength, TUint aOffset = 0) const;
    43         TInt Write(const void *aBuf, TUint32 aLength, TUint32 aOffset = 0);
    44         inline operator TUint8*()  const { return (TUint8*)(iMemPtr); }
    45         inline operator TUint16*() const { return (TUint16*)(iMemPtr); }
    46         inline operator TUint32*() const { return (TUint32*)(iMemPtr); }
    47     private:
    48         void*         iMemPtr;
    49         RMessagePtr2* iMessage;
    50         TInt          iBaseOffset;
    51     };
    52 
    53 #endif