os/mm/mmdevicefw/speechrecogsupport/ASR/inc/mmf/common/SpeechRecognitionDataClient.h
Update contrib.
1 // Copyright (c) 2002-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __SPEECHRECOGNITIONDATACLIENT_H__
17 #define __SPEECHRECOGNITIONDATACLIENT_H__
23 #include <mmf/common/mmfcontrollerframework.h>
24 #include <mmf/common/speechrecognitiondatacommon.h>
27 // FORWARD DECLARATION
37 Class to encapsulate a client recognition result.
38 The result is formulated for client consumption.
42 class CSDClientResult : public CBase
44 public: // Constructors and destructor
48 IMPORT_C ~CSDClientResult();
51 Two-phased constructor. Creates an uninitialised recognition result.
53 Can leave with one of the system-wide error codes
55 @return CSDClientResult object
57 IMPORT_C static CSDClientResult* NewL();
60 Two-phased constructor. Creates an uninitialised recognition result. A copy of the newly created class
61 is pushed onto the cleanup stack.
63 Can leave with one of the system-wide error codes.
65 @return CSDClientResult object
67 IMPORT_C static CSDClientResult* NewLC();
70 Two-phased constructor. Creates a result with a grammar and rule ID.
72 Can leave with one of the system-wide error codes.
75 The grammar ID of the result.
77 The rule ID of the result.
79 @return CSDClientResult object.
81 IMPORT_C static CSDClientResult* NewL(TGrammarID aGrammarID, TRuleID aRuleID);
84 Two-phased constructor. Creates a result with a grammar and rule ID. A copy of the newly created class
85 is pushed onto the cleanup stack.
87 Can leave with one of the system-wide error codes.
90 The grammar ID of the result
92 The rule ID of the result
94 @return CSDClientResult object.
96 IMPORT_C static CSDClientResult* NewLC(TGrammarID aGrammarID, TRuleID aRuleID);
99 Sets the grammar ID on the result.
102 The grammar identifier.
106 IMPORT_C void SetGrammarID(TGrammarID aGrammarID);
109 Retrieves the grammar ID of the result.
111 @return Grammar identifier.
114 IMPORT_C TGrammarID GrammarID() const;
117 Sets the rule ID of the result.
124 IMPORT_C void SetRuleID(TRuleID aRuleID);
127 Returns the rule ID of the result.
129 @return The rule identifier.
132 IMPORT_C TRuleID RuleID() const;
137 Writes the class to a stream.
140 A RWriteStream to write the class to.
144 void ExternalizeL(RWriteStream& aStream) const;
148 Reads the class from a stream.
151 A RReadStream to read from.
155 void InternalizeL(RReadStream& aStream);
160 CSDClientResult(TGrammarID aGrammarID, TRuleID aRuleID);
164 TGrammarID iGrammarID;
173 Class to encapsulate a client recogntion result set
174 This is a lightweight result set formulated for client consumption
178 class CSDClientResultSet : public CBase
180 public: // Constructors and destructor
184 IMPORT_C ~CSDClientResultSet();
187 Two-phased constructor.
189 @return CSDClientResultSet object.
191 IMPORT_C static CSDClientResultSet* NewL();
194 Two-phased constructor. Pushes the newly created object onto the cleanup stack
196 @return CSDClientResultSet object.
198 IMPORT_C static CSDClientResultSet* NewLC();
202 Sets the maximum number of best matches (N-best) expected in the recognition result after
206 The maximum number of matches expected in the recognition result.
210 IMPORT_C void SetMaxResultsL(TInt aMaxResults);
213 Returns the current value of the max number of expected after recognition.
215 @return The maximum number of best matches (N-best) expected in the recognition result.
219 IMPORT_C TInt MaxResults() const;
222 Returns a result at a given index within the result set.
225 The index of result to return.
227 @return A pointer to CSDClientResult object.
231 IMPORT_C const CSDClientResult& At(TInt aIndex) const;
234 Sets the number of results actually returned after recogntion.
237 The number of results returned by the recognizer.
241 IMPORT_C void SetResultCount(TInt aResultCount);
244 Returns the number of results actually returned after recogntion.
246 @return The number of results actually returned after recogntion.
250 IMPORT_C TInt ResultCount() const;
253 Sets the diagnostic of this result set.
256 The reference to the diagostic object.
260 IMPORT_C void SetDiagnostic(TDiagnostic& aDiagnostic);
263 Gets the diagnostic of this result set.
265 @return A reference to TDiagnostic object.
269 IMPORT_C const TDiagnostic& Diagnostic() const;
273 Writes the state of the class to a stream.
276 The stream to write to.
280 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
283 Restores the state of the object from a stream.
286 The stream to read from.
290 IMPORT_C void InternalizeL(RReadStream& aStream);
294 CSDClientResultSet();
297 TInt iMaxResults; // maximum number of results
298 TInt iResultCount; // number of recognition results
299 RPointerArray<CSDClientResult> iResultArray; // array of recognition results
300 TDiagnostic* iDiagnostic; // diagnostic information
303 #endif // __SPEECHRECOGNITIONDATACLIENT_H__