1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class definition of |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDE FILES |
|
20 #include <s32strm.h> |
|
21 #include <s32mem.h> |
|
22 |
|
23 // USER INCLUDE FILES |
|
24 #include "diagresultsdbrecordinfoarraypacked.h" |
|
25 #include "diagresultsdatabasetestrecordinfo.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // Constructor. |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 EXPORT_C TDiagResultsDbRecordInfoArrayPacked::TDiagResultsDbRecordInfoArrayPacked( |
|
34 CBufFlat*& aBuffer): iBuffer(aBuffer) |
|
35 { |
|
36 |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // Packs the array for sending across IPC. Flat buffer is used to deliver data. |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C void TDiagResultsDbRecordInfoArrayPacked::PackArrayL( |
|
44 const CArrayFixFlat<TDiagResultsDatabaseTestRecordInfo>& aInfoArray) |
|
45 { |
|
46 RBufWriteStream writeStream ( *iBuffer ); |
|
47 CleanupClosePushL( writeStream ); |
|
48 writeStream.WriteInt16L( aInfoArray.Count() ); |
|
49 |
|
50 for (TInt i=0; i < aInfoArray.Count(); ++i ) |
|
51 { |
|
52 aInfoArray[i].ExternalizeL( writeStream ); |
|
53 } |
|
54 |
|
55 CleanupStack::PopAndDestroy( &writeStream ); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // Unpack the array. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C void TDiagResultsDbRecordInfoArrayPacked::UnpackArrayL( |
|
63 CArrayFixFlat<TDiagResultsDatabaseTestRecordInfo>& aInfoArray) |
|
64 { |
|
65 RBufReadStream readStream ( *iBuffer ); |
|
66 CleanupClosePushL( readStream ); |
|
67 |
|
68 //how many cells needs to be unpacked |
|
69 TInt length = readStream.ReadInt16L(); |
|
70 |
|
71 for ( TInt i=0; i < length; ++i ) |
|
72 { |
|
73 TDiagResultsDatabaseTestRecordInfo info = |
|
74 TDiagResultsDatabaseTestRecordInfo(); |
|
75 info.InternalizeL( readStream ); |
|
76 aInfoArray.AppendL( info ) ; |
|
77 } |
|
78 CleanupStack::PopAndDestroy( &readStream ); |
|
79 } |
|