os/kernelhwsrv/kernel/eka/debug/crashMonitor/inc/scmbytestreamutil.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/debug/crashMonitor/inc/scmbytestreamutil.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,125 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +// WARNING: This file contains some APIs which are internal and are subject
    1.19 +//          to change without noticed. Such APIs should therefore not be used
    1.20 +//          outside the Kernel and Hardware Services package.
    1.21 +//
    1.22 +
    1.23 +#include <e32des8.h>
    1.24 +
    1.25 +namespace Debug 
    1.26 +	{
    1.27 +	/**
    1.28 +	 * TByteStreamReader implementation
    1.29 +	 */
    1.30 +	
    1.31 +	/**
    1.32 +	 * Returns the next byte from the stream
    1.33 +	 * @return TUint8 byte requested
    1.34 +	 */
    1.35 +	inline TUint8 TByteStreamReader::ReadByte()
    1.36 +		{
    1.37 +		return iBuffer[iPos++];		
    1.38 +		}
    1.39 +	
    1.40 +	/**
    1.41 +	 * Returns the next short from the stream
    1.42 +	 * @return TUint16 short requested
    1.43 +	 */	
    1.44 +	inline TUint16 TByteStreamReader::ReadShort()
    1.45 +		{
    1.46 +		TUint8 b1 = ReadByte();
    1.47 +		TUint8 b2 = ReadByte();	
    1.48 +		return (TUint16)(b1 + (b2 << 8));	
    1.49 +		}
    1.50 +		
    1.51 +	/**
    1.52 +	 * Returns the next TUInt32 from the stream
    1.53 +	 * @return TUInt32 TUInt32 requested
    1.54 +	 */		
    1.55 +	inline TUint32 TByteStreamReader::ReadInt()
    1.56 +		{
    1.57 +		TUint16 s1 = ReadShort();
    1.58 +		TUint16 s2 = ReadShort();	
    1.59 +		return s1 + (s2 << 16);		
    1.60 +		}
    1.61 +
    1.62 +	/**
    1.63 +	 * Returns the next TUInt64 from the stream
    1.64 +	 * @return TUInt64 TUInt64 requested
    1.65 +	 */		
    1.66 +	inline TUint64 TByteStreamReader::ReadInt64()
    1.67 +		{
    1.68 +		return  MAKE_TUINT64(ReadInt(), ReadInt()) ;
    1.69 +		}
    1.70 +	
    1.71 +	/**
    1.72 +	 * TByteStreamWriter implementation
    1.73 +	 */	
    1.74 +
    1.75 +	/**
    1.76 +	 * Writes a short to the stream
    1.77 +	 * @param aValue Value to write to stream
    1.78 +	 */	
    1.79 +	inline void TByteStreamWriter::WriteShort(TUint16 aValue)
    1.80 +		{
    1.81 +		WriteByte((TUint8) aValue);
    1.82 +		WriteByte((TUint8) (aValue >> 8));		
    1.83 +		}
    1.84 +	
    1.85 +	/**
    1.86 +	 * Writes an int to the stream
    1.87 +	 * @param aValue Value to write to stream
    1.88 +	 */	
    1.89 +	inline void TByteStreamWriter::WriteInt(TUint32 aValue)
    1.90 +		{
    1.91 +		WriteByte((TUint8)aValue);
    1.92 +		WriteByte((TUint8) (aValue >> 8));		
    1.93 +		WriteByte((TUint8) (aValue >> 16));		
    1.94 +		WriteByte((TUint8) (aValue >> 24));				
    1.95 +		}
    1.96 +	
    1.97 +	/**
    1.98 +	 * Writes a 64 bit int to the stream
    1.99 +	 * @param aValue Value to write to stream
   1.100 +	 */		
   1.101 +	inline void TByteStreamWriter::WriteInt64(TUint64 aValue)
   1.102 +		{
   1.103 +		WriteInt(I64HIGH(aValue));
   1.104 +		WriteInt(I64LOW(aValue));			
   1.105 +		}
   1.106 +	
   1.107 +	/**
   1.108 +	 * Enables physical writing such that the physical writers DoPhysicalWrite
   1.109 +	 * method will be invoked upon a write. This may write to a given media
   1.110 +	 * as defined by the implementation of this method 
   1.111 +	 */		
   1.112 +	inline void TByteStreamWriter::EnablePhysicalWriting()
   1.113 +		{
   1.114 +		iPhysEnabled = ETrue;
   1.115 +		}
   1.116 +
   1.117 +	/**
   1.118 +	 * Disables physical writing such that the physical writers DoPhysicalWrite
   1.119 +	 * method will not be invoked upon a write. 
   1.120 +	 */	
   1.121 +	inline void TByteStreamWriter::DisablePhysicalWriting()
   1.122 +		{
   1.123 +		iPhysEnabled = EFalse;
   1.124 +		}
   1.125 +	}
   1.126 +
   1.127 +
   1.128 +//eof