sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __SPEECHRECOGNITIONDATACLIENT_H__ sl@0: #define __SPEECHRECOGNITIONDATACLIENT_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // INCLUDES sl@0: #include sl@0: #include sl@0: sl@0: sl@0: // FORWARD DECLARATION sl@0: class TDiagnostic; sl@0: sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Class to encapsulate a client recognition result. sl@0: The result is formulated for client consumption. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: class CSDClientResult : public CBase sl@0: { sl@0: public: // Constructors and destructor sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C ~CSDClientResult(); sl@0: sl@0: /** sl@0: Two-phased constructor. Creates an uninitialised recognition result. sl@0: sl@0: Can leave with one of the system-wide error codes sl@0: sl@0: @return CSDClientResult object sl@0: */ sl@0: IMPORT_C static CSDClientResult* NewL(); sl@0: sl@0: /** sl@0: Two-phased constructor. Creates an uninitialised recognition result. A copy of the newly created class sl@0: is pushed onto the cleanup stack. sl@0: sl@0: Can leave with one of the system-wide error codes. sl@0: sl@0: @return CSDClientResult object sl@0: */ sl@0: IMPORT_C static CSDClientResult* NewLC(); sl@0: sl@0: /** sl@0: Two-phased constructor. Creates a result with a grammar and rule ID. sl@0: sl@0: Can leave with one of the system-wide error codes. sl@0: sl@0: @param aGrammarID sl@0: The grammar ID of the result. sl@0: @param aRuleID sl@0: The rule ID of the result. sl@0: sl@0: @return CSDClientResult object. sl@0: */ sl@0: IMPORT_C static CSDClientResult* NewL(TGrammarID aGrammarID, TRuleID aRuleID); sl@0: sl@0: /** sl@0: Two-phased constructor. Creates a result with a grammar and rule ID. A copy of the newly created class sl@0: is pushed onto the cleanup stack. sl@0: sl@0: Can leave with one of the system-wide error codes. sl@0: sl@0: @param aGrammarID sl@0: The grammar ID of the result sl@0: @param aRuleID sl@0: The rule ID of the result sl@0: sl@0: @return CSDClientResult object. sl@0: */ sl@0: IMPORT_C static CSDClientResult* NewLC(TGrammarID aGrammarID, TRuleID aRuleID); sl@0: sl@0: /** sl@0: Sets the grammar ID on the result. sl@0: sl@0: @param aGrammarID sl@0: The grammar identifier. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void SetGrammarID(TGrammarID aGrammarID); sl@0: sl@0: /** sl@0: Retrieves the grammar ID of the result. sl@0: sl@0: @return Grammar identifier. sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C TGrammarID GrammarID() const; sl@0: sl@0: /** sl@0: Sets the rule ID of the result. sl@0: sl@0: @param aRuleID sl@0: The rule identifier. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void SetRuleID(TRuleID aRuleID); sl@0: sl@0: /** sl@0: Returns the rule ID of the result. sl@0: sl@0: @return The rule identifier. sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C TRuleID RuleID() const; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Writes the class to a stream. sl@0: sl@0: @param aStream sl@0: A RWriteStream to write the class to. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void ExternalizeL(RWriteStream& aStream) const; sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Reads the class from a stream. sl@0: sl@0: @param aStream sl@0: A RReadStream to read from. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: void InternalizeL(RReadStream& aStream); sl@0: sl@0: private: sl@0: void ConstructL(); sl@0: CSDClientResult(); sl@0: CSDClientResult(TGrammarID aGrammarID, TRuleID aRuleID); sl@0: sl@0: sl@0: private: sl@0: TGrammarID iGrammarID; sl@0: TRuleID iRuleID; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Class to encapsulate a client recogntion result set sl@0: This is a lightweight result set formulated for client consumption sl@0: sl@0: @since 8.0 sl@0: */ sl@0: class CSDClientResultSet : public CBase sl@0: { sl@0: public: // Constructors and destructor sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C ~CSDClientResultSet(); sl@0: sl@0: /** sl@0: Two-phased constructor. sl@0: sl@0: @return CSDClientResultSet object. sl@0: */ sl@0: IMPORT_C static CSDClientResultSet* NewL(); sl@0: sl@0: /** sl@0: Two-phased constructor. Pushes the newly created object onto the cleanup stack sl@0: sl@0: @return CSDClientResultSet object. sl@0: */ sl@0: IMPORT_C static CSDClientResultSet* NewLC(); sl@0: sl@0: sl@0: /** sl@0: Sets the maximum number of best matches (N-best) expected in the recognition result after sl@0: recognition. sl@0: sl@0: @param aMaxResults sl@0: The maximum number of matches expected in the recognition result. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void SetMaxResultsL(TInt aMaxResults); sl@0: sl@0: /** sl@0: Returns the current value of the max number of expected after recognition. sl@0: sl@0: @return The maximum number of best matches (N-best) expected in the recognition result. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C TInt MaxResults() const; sl@0: sl@0: /** sl@0: Returns a result at a given index within the result set. sl@0: sl@0: @param aIndex sl@0: The index of result to return. sl@0: sl@0: @return A pointer to CSDClientResult object. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C const CSDClientResult& At(TInt aIndex) const; sl@0: sl@0: /** sl@0: Sets the number of results actually returned after recogntion. sl@0: sl@0: @param aResultCount sl@0: The number of results returned by the recognizer. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void SetResultCount(TInt aResultCount); sl@0: sl@0: /** sl@0: Returns the number of results actually returned after recogntion. sl@0: sl@0: @return The number of results actually returned after recogntion. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C TInt ResultCount() const; sl@0: sl@0: /** sl@0: Sets the diagnostic of this result set. sl@0: sl@0: @param aDiagnostic sl@0: The reference to the diagostic object. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void SetDiagnostic(TDiagnostic& aDiagnostic); sl@0: sl@0: /** sl@0: Gets the diagnostic of this result set. sl@0: sl@0: @return A reference to TDiagnostic object. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C const TDiagnostic& Diagnostic() const; sl@0: sl@0: sl@0: /** sl@0: Writes the state of the class to a stream. sl@0: sl@0: @param aStream sl@0: The stream to write to. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; sl@0: sl@0: /** sl@0: Restores the state of the object from a stream. sl@0: sl@0: @param aStream sl@0: The stream to read from. sl@0: sl@0: @since 8.0 sl@0: */ sl@0: IMPORT_C void InternalizeL(RReadStream& aStream); sl@0: sl@0: private: sl@0: void ConstructL(); sl@0: CSDClientResultSet(); sl@0: sl@0: private: sl@0: TInt iMaxResults; // maximum number of results sl@0: TInt iResultCount; // number of recognition results sl@0: RPointerArray iResultArray; // array of recognition results sl@0: TDiagnostic* iDiagnostic; // diagnostic information sl@0: }; sl@0: sl@0: #endif // __SPEECHRECOGNITIONDATACLIENT_H__ sl@0: