srsfenginestub/common/inc/nsssispeechrecognitiondataclient.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2004 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:     This file contains definition of the SISpeechRecognitionDataClient structure and API.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __SRSSIDATA_CLIENT_H__
       
    23 #define __SRSSIDATA_CLIENT_H__
       
    24 
       
    25 //  INCLUDES
       
    26 #include <nsssispeechrecognitiondatacommon.h>
       
    27  
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class  CSIResultSet;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Class to encapsulate a client recognition result.
       
    37 *  The result is formulated for client consumption.
       
    38 *
       
    39 *  @lib nsssispeechrecognitiondata.lib
       
    40 *  @since 2.5
       
    41 */
       
    42 
       
    43 class CSIClientResult : public CBase
       
    44 {
       
    45 public:	 // Constructors and destructor
       
    46         /**
       
    47         * Destructor.
       
    48         */
       
    49 	IMPORT_C ~CSIClientResult();
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53 	IMPORT_C static CSIClientResult* NewL();
       
    54 	IMPORT_C static CSIClientResult* NewLC();
       
    55 	IMPORT_C static CSIClientResult* NewL(TSIGrammarID aGrammarID, TSIRuleID aRuleID);
       
    56 	IMPORT_C static CSIClientResult* NewLC(TSIGrammarID aGrammarID, TSIRuleID aRuleID);
       
    57 
       
    58 		/**
       
    59         * Use to set the grammar Id on the result.
       
    60         * @since 2.5
       
    61         * @param aGrammarID - grammar identifier.
       
    62         * @return None.
       
    63 		*/
       
    64 	IMPORT_C void SetGrammarID(TSIGrammarID aGrammarID);
       
    65 
       
    66 		/**
       
    67         * Use to retrieve the grammar Id of the result.
       
    68         * @since 2.5
       
    69 		* @param None.
       
    70         * @return Grammar identifier.
       
    71         */
       
    72 	IMPORT_C TSIGrammarID GrammarID() const;
       
    73 
       
    74 		/**
       
    75         * Use to set the rule Id of the result.
       
    76         * @since 2.5
       
    77         * @param aRuleID - rule identifier.
       
    78 		* @return None.
       
    79         */
       
    80 	IMPORT_C void SetRuleID(TSIRuleID aRuleID);
       
    81 
       
    82 		/**
       
    83         * Use to retrieve the rule Id of the result.
       
    84         * @since 2.5
       
    85 		* @param None.
       
    86         * @return Rule identifier.
       
    87         */ 
       
    88 	IMPORT_C TSIRuleID RuleID() const;
       
    89 
       
    90 private:
       
    91 	void ConstructL();
       
    92 	CSIClientResult();
       
    93 	CSIClientResult(TSIGrammarID aGrammarID, TSIRuleID aRuleID);
       
    94 
       
    95 private:
       
    96 	TSIGrammarID iGrammarID;
       
    97 	TSIRuleID iRuleID;
       
    98 };
       
    99 
       
   100 
       
   101 /**
       
   102 *  Class to encapsulate a client recogntion result set
       
   103 *  This is a lightweight result set formulated for client consumption
       
   104 *
       
   105 *  @lib nsssispeechrecognitiondata.lib
       
   106 *  @since 2.5
       
   107 */
       
   108 
       
   109 class CSIClientResultSet : public CBase
       
   110 {
       
   111 public:	// Constructors and destructor
       
   112         /**
       
   113         * Destructor.
       
   114         */
       
   115 	IMPORT_C ~CSIClientResultSet();
       
   116 
       
   117 	    /**
       
   118         * Two-phased constructor.
       
   119         */
       
   120 	IMPORT_C static CSIClientResultSet* NewL();
       
   121 	IMPORT_C static CSIClientResultSet* NewLC();
       
   122 
       
   123 		/**
       
   124 			* Use to add a result to the result set.
       
   125 			* @since 2.5
       
   126 			* @param aResult - reference to the result object to be added.
       
   127 			* @return KErrNone, if the insertion is successful, otherwise one of the system wide error codes.
       
   128 		*/
       
   129 		IMPORT_C void AddL( const  CSIClientResult* aResult); 
       
   130 		
       
   131 		
       
   132 		/**
       
   133 			* Use to delete a result to the result set.
       
   134 			* @since 2.5
       
   135 			* @param aIndex Index of  .
       
   136 			* @return 
       
   137 			*/
       
   138 		IMPORT_C void DeleteL(TInt aIndex) ;	
       
   139 		/**
       
   140         * Sets the maximum number of best matches (N-best) expected in the recognition result after recognition.
       
   141         * @since 2.5
       
   142         * @param aMaxResults - the maximum number of matches expected in the recognition result.
       
   143 		* @return None.
       
   144         */
       
   145 	IMPORT_C void SetMaxResultsL(TInt aMaxResults);
       
   146 
       
   147 		/**
       
   148         * Use to retrieve the current value of the max number of expected after recognition.
       
   149         * @since 2.5
       
   150         * @param None.
       
   151 		* @return The maximum number of best matches (N-best) expected in the recognition result.
       
   152         */ 
       
   153 	IMPORT_C TInt MaxResults() const;
       
   154 
       
   155 		/**
       
   156         * Use to retrieve a result at a given index within the result set.
       
   157         * @since 2.5
       
   158         * @param None.
       
   159 		* @return Pointer to CSIClientResult object.
       
   160         */
       
   161 	IMPORT_C const CSIClientResult& AtL(TInt anIndex) const;
       
   162 
       
   163 		/**
       
   164         * Use to set the number of results actually returned after recogntion.
       
   165         * @since 2.5
       
   166         * @param aResultCount - number of results returned by the recognizer.
       
   167 		* @return None.
       
   168         */
       
   169 	IMPORT_C void SetResultCount(TInt aResultCount);
       
   170 
       
   171 		/**
       
   172         * Use to retrieve the number of results actually returned after recogntion.
       
   173         * @since 2.5
       
   174         * @param None.
       
   175 		* @return Number of results actually returned after recogntion.
       
   176         */
       
   177 	IMPORT_C TInt ResultCount() const;
       
   178  
       
   179 
       
   180 	IMPORT_C  CSIResultSet& SIResultSet() const;
       
   181 
       
   182 	
       
   183 	IMPORT_C void SetSIResultSet(CSIResultSet* aSIResultSet);
       
   184 
       
   185 		/**
       
   186         * Internalize to a data stream
       
   187         * @since 2.8
       
   188 		* @param aStream Data stream
       
   189         * @return  None
       
   190         */ 
       
   191 	IMPORT_C virtual void InternalizeL( RReadStream& aStream );
       
   192 
       
   193 		/**
       
   194         * Externalize from a data stream
       
   195         * @since 2.8
       
   196 		* @param None
       
   197         * @return  aStream Data stream
       
   198         */ 
       
   199 	IMPORT_C virtual void ExternalizeL( RWriteStream& aStream ) const;
       
   200 
       
   201 private:
       
   202 	void ConstructL();
       
   203 	CSIClientResultSet();
       
   204 
       
   205 private:
       
   206 	TInt iMaxResults;
       
   207 	TInt iResultCount;
       
   208 	RPointerArray<CSIClientResult> iResultArray;
       
   209 	CSIResultSet* iSIResultSet;
       
   210 };
       
   211 
       
   212 #endif
       
   213