Home | History | Annotate | Download | only in include
      1 /*---------------------------------------------------------------------------*
      2  *  SR_AcousticModelsImpl.h  *
      3  *                                                                           *
      4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
      5  *                                                                           *
      6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
      7  *  you may not use this file except in compliance with the License.         *
      8  *                                                                           *
      9  *  You may obtain a copy of the License at                                  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
     11  *                                                                           *
     12  *  Unless required by applicable law or agreed to in writing, software      *
     13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
     14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
     15  *  See the License for the specific language governing permissions and      *
     16  *  limitations under the License.                                           *
     17  *                                                                           *
     18  *---------------------------------------------------------------------------*/
     19 
     20 #ifndef __SR_ACOUSTICMODELSIMPL_H
     21 #define __SR_ACOUSTICMODELSIMPL_H
     22 
     23 
     24 
     25 #ifndef __vxworks
     26 #include <memory.h>
     27 #endif
     28 #include "SR_AcousticModels.h"
     29 #include "SR_RecognizerImpl.h"
     30 #include "ESR_ReturnCode.h"
     31 
     32 /* Legacy CREC headers */
     33 #include "simapi.h"
     34 
     35 /**
     36  * AcousticModels implementation.
     37  */
     38 typedef struct SR_AcousticModelsImpl_t
     39 {
     40   /**
     41    * Interface functions that must be implemented.
     42    */
     43   SR_AcousticModels Interface;
     44 
     45   /**
     46    * When AcousticModels are associated with a Recognizer, they initialize their
     47    * Pattern objects using that Recognizer.
     48    *
     49    * @param self SR_AcousticModels handle
     50    * @param recognizer The recognizer
     51    */
     52   ESR_ReturnCode(*setupPattern)(SR_AcousticModels* self, SR_Recognizer* recognizer);
     53   /**
     54    * When AcousticModels are deassociated with a Recognizer, they deinitialize their
     55    * Pattern objects.
     56    *
     57    * @param self SR_AcousticModels handle
     58    */
     59   ESR_ReturnCode(*unsetupPattern)(SR_AcousticModels* self);
     60   /**
     61    * Generate legacy AcousticModels parameter structure from ESR_Session.
     62    *
     63    * @param params Resulting structure
     64    */
     65   ESR_ReturnCode(*getLegacyParameters)(CA_AcoustInputParams* params);
     66 
     67   /**
     68    * AcousticModels parameters.
     69    */
     70   HashMap* parameters;
     71   /**
     72    * Legacy CREC pattern.
     73    */
     74   CA_Pattern* pattern;
     75   /**
     76    * ArrayList of legacy CREC acoustic models.
     77    */
     78   ArrayList* acoustic;
     79   /**
     80    * Legacy Arbdata structure.
     81    */
     82   CA_Arbdata* arbdata;
     83   /**
     84    * Contents of AcousticModels.
     85    */
     86   void* contents;
     87   /**
     88    * Size of contents.
     89    */
     90   int size;
     91 }
     92 SR_AcousticModelsImpl;
     93 
     94 
     95 /**
     96  * Default implementation.
     97  */
     98 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_Destroy(SR_AcousticModels* self);
     99 /**
    100  * Default implementation.
    101  */
    102 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_Save(SR_AcousticModels* self,
    103     const LCHAR* filename);
    104 /**
    105  * Default implementation.
    106  */
    107 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_SetParameter(SR_AcousticModels* self,
    108     const LCHAR* key,
    109     LCHAR* value);
    110 /**
    111  * Default implementation.
    112  */
    113 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_GetParameter(SR_AcousticModels* self,
    114     const LCHAR* key,
    115     LCHAR* value, size_t* len);
    116 /**
    117  * Default implementation.
    118  */
    119 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_GetCount(SR_AcousticModels* self,
    120     size_t* size);
    121 /**
    122  * Default implementation.
    123  */
    124 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_GetID(SR_AcousticModels* self,
    125     size_t index,
    126     SR_AcousticModelID* id,
    127     size_t* size);
    128 /**
    129  * Default implementation.
    130  */
    131 SREC_ACOUSTICMODELS_API ESR_ReturnCode SR_AcousticModels_SetID(SR_AcousticModels* self,
    132     size_t index,
    133     SR_AcousticModelID* id);
    134 /**
    135  * Default implementation.
    136  */
    137 SREC_ACOUSTICMODELS_API void* SR_AcousticModels_GetArbdata(SR_AcousticModels* self);
    138 
    139 /**
    140  * When AcousticModels are associated with a Recognizer, they initialize their
    141  * Pattern objects using that Recognizer.
    142  *
    143  * @param self SR_AcousticModels handle
    144  * @param recognizer The recognizer
    145  */
    146 ESR_ReturnCode SR_AcousticModels_SetupPattern(SR_AcousticModels* self, SR_Recognizer* recognizer);
    147 /**
    148  * When AcousticModels are deassociated with a Recognizer, they deinitialize their
    149  * Pattern objects.
    150  *
    151  * @param self SR_AcousticModels handle
    152  */
    153 ESR_ReturnCode SR_AcousticModels_UnsetupPattern(SR_AcousticModels* self);
    154 /**
    155  * Generate legacy AcousticModels parameter structure from ESR_Session.
    156  *
    157  * @param params Resulting structure
    158  */
    159 ESR_ReturnCode SR_AcousticModels_GetLegacyParameters(CA_AcoustInputParams* params);
    160 
    161 
    162 #endif /* __SR_ACOUSTICMODELSIMPL_H */
    163