|
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 CDiagResultsDbRecordEngineParam |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32std.h> |
|
20 |
|
21 #include "diagresultsdbrecordengineparam.h" |
|
22 |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // NewL.Used when creating the object from a stream that contains the |
|
26 // serialized object. |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C CDiagResultsDbRecordEngineParam* CDiagResultsDbRecordEngineParam::NewL ( |
|
30 RReadStream& aStream ) |
|
31 { |
|
32 CDiagResultsDbRecordEngineParam* self = |
|
33 new( ELeave ) CDiagResultsDbRecordEngineParam(); |
|
34 |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL( aStream ); |
|
37 CleanupStack::Pop(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // NewL |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CDiagResultsDbRecordEngineParam* CDiagResultsDbRecordEngineParam::NewL |
|
46 ( |
|
47 RArray<TUid>* aInitialUids, |
|
48 TBool aDependencyExecution |
|
49 ) |
|
50 { |
|
51 CDiagResultsDbRecordEngineParam* self = |
|
52 new( ELeave ) CDiagResultsDbRecordEngineParam( |
|
53 aInitialUids, |
|
54 aDependencyExecution ); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // NewLC. |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 EXPORT_C CDiagResultsDbRecordEngineParam* CDiagResultsDbRecordEngineParam::NewLC ( |
|
68 RArray<TUid>* aInitialUids, |
|
69 TBool aDependencyExecution |
|
70 ) |
|
71 { |
|
72 CDiagResultsDbRecordEngineParam* self = |
|
73 new( ELeave ) CDiagResultsDbRecordEngineParam( |
|
74 aInitialUids, |
|
75 aDependencyExecution ); |
|
76 CleanupStack::PushL( self ); |
|
77 self->ConstructL(); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // ConstructL. |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CDiagResultsDbRecordEngineParam::ConstructL ( RReadStream& aStream ) |
|
86 { |
|
87 InternalizeL( aStream ); |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // ConstructL. |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CDiagResultsDbRecordEngineParam::ConstructL () |
|
95 { |
|
96 if ( !iExecutionUids ) |
|
97 { |
|
98 User::Leave( KErrArgument ); |
|
99 } |
|
100 |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // Destructor. |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 EXPORT_C CDiagResultsDbRecordEngineParam::~CDiagResultsDbRecordEngineParam() |
|
109 { |
|
110 iExecutionUids->Close(); |
|
111 delete iExecutionUids; |
|
112 iExecutionUids = NULL; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // C++ default constructor. |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CDiagResultsDbRecordEngineParam::CDiagResultsDbRecordEngineParam() |
|
120 { |
|
121 |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // Return execution uid array. |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 EXPORT_C const RArray<TUid>& CDiagResultsDbRecordEngineParam::ExecutionsUidArray() const |
|
129 { |
|
130 return *iExecutionUids; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // Return dependency execution. |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C TBool CDiagResultsDbRecordEngineParam::DependencyExecution() const |
|
138 { |
|
139 return iDependencyExecution; |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // Externalize this object into a stream. |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C void CDiagResultsDbRecordEngineParam::ExternalizeL( |
|
147 RWriteStream& aStream ) const |
|
148 { |
|
149 aStream.WriteInt16L( iExecutionUids->Count() ); |
|
150 |
|
151 for (TInt i=0; i < iExecutionUids->Count(); ++i ) |
|
152 { |
|
153 aStream.WriteInt32L( (*iExecutionUids)[i].iUid ); |
|
154 } |
|
155 |
|
156 aStream.WriteUint8L ( iDependencyExecution ); |
|
157 } |
|
158 |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // Internalize the object from a stream. |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 EXPORT_C void CDiagResultsDbRecordEngineParam::InternalizeL( RReadStream& aStream ) |
|
165 { |
|
166 iExecutionUids = new (ELeave) RArray<TUid>(10); |
|
167 |
|
168 TInt length = aStream.ReadInt16L(); |
|
169 |
|
170 for ( TInt i=0; i < length; ++i ) |
|
171 { |
|
172 |
|
173 iExecutionUids->AppendL( TUid::Uid( aStream.ReadInt32L() ) ); |
|
174 } |
|
175 |
|
176 iDependencyExecution = aStream.ReadUint8L(); |
|
177 } |
|
178 |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // Constructor. |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 CDiagResultsDbRecordEngineParam::CDiagResultsDbRecordEngineParam ( |
|
185 RArray<TUid>* aInitialUids, |
|
186 TBool aDependencyExecution ) |
|
187 { |
|
188 iExecutionUids = aInitialUids; |
|
189 iDependencyExecution = aDependencyExecution; |
|
190 } |
|
191 |
|
192 |
|
193 |
|
194 |