persistentstorage/sql/SRC/Client/IPC/IPCBuf.inl
changeset 0 08ec8eefde2f
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 // Sets the read position.
       
    15 // 
       
    16 //
       
    17 
       
    18 inline void HIpcBuf::SetPos(TRead, TInt aPos)
       
    19 	{
       
    20 	iRPos = aPos;
       
    21 	}
       
    22 
       
    23 /**
       
    24 Sets the write position.
       
    25 */
       
    26 inline void HIpcBuf::SetPos(TWrite, TInt aPos)
       
    27 	{
       
    28 	iWPos = aPos;
       
    29 	}
       
    30 
       
    31 /**
       
    32 @return Read position
       
    33 */
       
    34 inline TInt HIpcBuf::Pos(TRead) const
       
    35 	{
       
    36 	return iRPos;
       
    37 	}
       
    38 
       
    39 /**
       
    40 @return Write position
       
    41 */
       
    42 inline TInt HIpcBuf::Pos(TWrite) const
       
    43 	{
       
    44 	return iWPos;
       
    45 	}
       
    46 
       
    47 /**
       
    48 Moves the read position.
       
    49 */
       
    50 inline TInt HIpcBuf::MovePos(TRead, TInt aOffset)
       
    51 	{
       
    52 	return iRPos += aOffset;
       
    53 	}
       
    54 
       
    55 /**
       
    56 @return The difference between read and write positions.
       
    57 */
       
    58 inline TInt HIpcBuf::Lag(TRead) const
       
    59 	{
       
    60 	return Ptr(ERead) - End(ERead);
       
    61 	}
       
    62 
       
    63 /**
       
    64 @return The difference between the write position and the beginning of the buffer.
       
    65 */
       
    66 inline TInt HIpcBuf::Lag(TWrite) const
       
    67 	{
       
    68 	return Ptr(EWrite) - iBuf.iData;
       
    69 	}
       
    70 
       
    71 inline TInt HIpcBuf::Mark(TRead) const
       
    72 	{
       
    73 	return Pos(ERead) + Lag(ERead);
       
    74 	}
       
    75 
       
    76 inline TInt HIpcBuf::Mark(TWrite) const
       
    77 	{
       
    78 	return Pos(EWrite) + Lag(EWrite);
       
    79 	}