author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of the License "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// |
sl@0 | 15 |
// WARNING: This file contains some APIs which are internal and are subject |
sl@0 | 16 |
// to change without noticed. Such APIs should therefore not be used |
sl@0 | 17 |
// outside the Kernel and Hardware Services package. |
sl@0 | 18 |
// |
sl@0 | 19 |
|
sl@0 | 20 |
#include <e32des8.h> |
sl@0 | 21 |
|
sl@0 | 22 |
namespace Debug |
sl@0 | 23 |
{ |
sl@0 | 24 |
/** |
sl@0 | 25 |
* TByteStreamReader implementation |
sl@0 | 26 |
*/ |
sl@0 | 27 |
|
sl@0 | 28 |
/** |
sl@0 | 29 |
* Returns the next byte from the stream |
sl@0 | 30 |
* @return TUint8 byte requested |
sl@0 | 31 |
*/ |
sl@0 | 32 |
inline TUint8 TByteStreamReader::ReadByte() |
sl@0 | 33 |
{ |
sl@0 | 34 |
return iBuffer[iPos++]; |
sl@0 | 35 |
} |
sl@0 | 36 |
|
sl@0 | 37 |
/** |
sl@0 | 38 |
* Returns the next short from the stream |
sl@0 | 39 |
* @return TUint16 short requested |
sl@0 | 40 |
*/ |
sl@0 | 41 |
inline TUint16 TByteStreamReader::ReadShort() |
sl@0 | 42 |
{ |
sl@0 | 43 |
TUint8 b1 = ReadByte(); |
sl@0 | 44 |
TUint8 b2 = ReadByte(); |
sl@0 | 45 |
return (TUint16)(b1 + (b2 << 8)); |
sl@0 | 46 |
} |
sl@0 | 47 |
|
sl@0 | 48 |
/** |
sl@0 | 49 |
* Returns the next TUInt32 from the stream |
sl@0 | 50 |
* @return TUInt32 TUInt32 requested |
sl@0 | 51 |
*/ |
sl@0 | 52 |
inline TUint32 TByteStreamReader::ReadInt() |
sl@0 | 53 |
{ |
sl@0 | 54 |
TUint16 s1 = ReadShort(); |
sl@0 | 55 |
TUint16 s2 = ReadShort(); |
sl@0 | 56 |
return s1 + (s2 << 16); |
sl@0 | 57 |
} |
sl@0 | 58 |
|
sl@0 | 59 |
/** |
sl@0 | 60 |
* Returns the next TUInt64 from the stream |
sl@0 | 61 |
* @return TUInt64 TUInt64 requested |
sl@0 | 62 |
*/ |
sl@0 | 63 |
inline TUint64 TByteStreamReader::ReadInt64() |
sl@0 | 64 |
{ |
sl@0 | 65 |
return MAKE_TUINT64(ReadInt(), ReadInt()) ; |
sl@0 | 66 |
} |
sl@0 | 67 |
|
sl@0 | 68 |
/** |
sl@0 | 69 |
* TByteStreamWriter implementation |
sl@0 | 70 |
*/ |
sl@0 | 71 |
|
sl@0 | 72 |
/** |
sl@0 | 73 |
* Writes a short to the stream |
sl@0 | 74 |
* @param aValue Value to write to stream |
sl@0 | 75 |
*/ |
sl@0 | 76 |
inline void TByteStreamWriter::WriteShort(TUint16 aValue) |
sl@0 | 77 |
{ |
sl@0 | 78 |
WriteByte((TUint8) aValue); |
sl@0 | 79 |
WriteByte((TUint8) (aValue >> 8)); |
sl@0 | 80 |
} |
sl@0 | 81 |
|
sl@0 | 82 |
/** |
sl@0 | 83 |
* Writes an int to the stream |
sl@0 | 84 |
* @param aValue Value to write to stream |
sl@0 | 85 |
*/ |
sl@0 | 86 |
inline void TByteStreamWriter::WriteInt(TUint32 aValue) |
sl@0 | 87 |
{ |
sl@0 | 88 |
WriteByte((TUint8)aValue); |
sl@0 | 89 |
WriteByte((TUint8) (aValue >> 8)); |
sl@0 | 90 |
WriteByte((TUint8) (aValue >> 16)); |
sl@0 | 91 |
WriteByte((TUint8) (aValue >> 24)); |
sl@0 | 92 |
} |
sl@0 | 93 |
|
sl@0 | 94 |
/** |
sl@0 | 95 |
* Writes a 64 bit int to the stream |
sl@0 | 96 |
* @param aValue Value to write to stream |
sl@0 | 97 |
*/ |
sl@0 | 98 |
inline void TByteStreamWriter::WriteInt64(TUint64 aValue) |
sl@0 | 99 |
{ |
sl@0 | 100 |
WriteInt(I64HIGH(aValue)); |
sl@0 | 101 |
WriteInt(I64LOW(aValue)); |
sl@0 | 102 |
} |
sl@0 | 103 |
|
sl@0 | 104 |
/** |
sl@0 | 105 |
* Enables physical writing such that the physical writers DoPhysicalWrite |
sl@0 | 106 |
* method will be invoked upon a write. This may write to a given media |
sl@0 | 107 |
* as defined by the implementation of this method |
sl@0 | 108 |
*/ |
sl@0 | 109 |
inline void TByteStreamWriter::EnablePhysicalWriting() |
sl@0 | 110 |
{ |
sl@0 | 111 |
iPhysEnabled = ETrue; |
sl@0 | 112 |
} |
sl@0 | 113 |
|
sl@0 | 114 |
/** |
sl@0 | 115 |
* Disables physical writing such that the physical writers DoPhysicalWrite |
sl@0 | 116 |
* method will not be invoked upon a write. |
sl@0 | 117 |
*/ |
sl@0 | 118 |
inline void TByteStreamWriter::DisablePhysicalWriting() |
sl@0 | 119 |
{ |
sl@0 | 120 |
iPhysEnabled = EFalse; |
sl@0 | 121 |
} |
sl@0 | 122 |
} |
sl@0 | 123 |
|
sl@0 | 124 |
|
sl@0 | 125 |
//eof |