persistentstorage/sql/SRC/Server/IPC/IPCStream.inl
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-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 "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 // ////////////////////////             HIpcStream                 ///////////////////////////////////////
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  
       
    20  Initializes HIpcStream data members.
       
    21  
       
    22  @param aHost A pointer to the buffer with the stream data
       
    23  @param aReadPos The position data has to be read from
       
    24  
       
    25  @see HIpcStream::SynchL()
       
    26  
       
    27  @panic SqlDb 7 In _DEBUG mode. aHost is NULL.
       
    28 */
       
    29 inline HIpcStream::HIpcStream(MStreamBuf* aHost, TInt aReadPos):
       
    30 	iHost(*aHost),
       
    31 	iRPos(aReadPos),
       
    32 	iWPos(0)
       
    33 	{
       
    34 	__SQLASSERT(aHost != NULL, ESqlPanicInternalError);
       
    35 	}
       
    36 
       
    37 /**
       
    38 Relases the stream buffer.
       
    39 */
       
    40 inline HIpcStream::~HIpcStream()
       
    41 	{
       
    42 	iHost.Release();
       
    43 	}
       
    44 
       
    45 /**
       
    46 @return The stream data size.
       
    47 */
       
    48 inline TInt HIpcStream::SizeL()
       
    49 	{
       
    50 	return iHost.SizeL();
       
    51 	}
       
    52 
       
    53 /**
       
    54 Synchronizes the stream data buffer with the stream.
       
    55 
       
    56 @see HIpcStream::HIpcStream()
       
    57 */
       
    58 inline void HIpcStream::SynchL()
       
    59 	{
       
    60 	iHost.SynchL();
       
    61 	}
       
    62 
       
    63 
       
    64 //////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    65 ///////////////////////////             HIpcReadBuf                 //////////////////////////////////////
       
    66 //////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    67 
       
    68 /**
       
    69 Initializes HIpcReadBuf data members.
       
    70 
       
    71 @param aDes Points to the data which will be accessed via HIpcReadBuf instance.
       
    72 */
       
    73 inline HIpcReadBuf::HIpcReadBuf(const TDesC8& aDes)
       
    74 	{
       
    75 	TUint8* ptr = const_cast <TUint8*> (aDes.Ptr());
       
    76 	Set(ptr, ptr + aDes.Length(), MStreamBuf::ERead);
       
    77 	}
       
    78 
       
    79 /**
       
    80 Creates an instance of HIpcReadBuf class.
       
    81 
       
    82 @param aDes Points to the data which will be accessed via HIpcReadBuf instance.
       
    83 
       
    84 @return A pointer to the created HIpcReadBuf instance.
       
    85 
       
    86 @leave KErrNoMemory, an out of memory condition has occured;
       
    87 */
       
    88 inline HIpcReadBuf* HIpcReadBuf::NewL(const TDesC8& aDes)
       
    89 	{
       
    90 	return new (ELeave) HIpcReadBuf(aDes);
       
    91 	}