1 /*---------------------------------------------------------------------------* 2 * AcousticModels.c * 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 #include "SR_AcousticModels.h" 21 #include "SR_AcousticModelsImpl.h" 22 #include "plog.h" 23 #include "pmemory.h" 24 25 26 ESR_ReturnCode SR_AcousticModelsDestroy(SR_AcousticModels* self) 27 { 28 if (self == NULL) 29 { 30 PLogError(L("ESR_INVALID_ARGUMENT")); 31 return ESR_INVALID_ARGUMENT; 32 } 33 return self->destroy(self); 34 } 35 36 ESR_ReturnCode SR_AcousticModelsSave(SR_AcousticModels* self, const LCHAR* filename) 37 { 38 if (self == NULL) 39 { 40 PLogError(L("ESR_INVALID_ARGUMENT")); 41 return ESR_INVALID_ARGUMENT; 42 } 43 return self->save(self, filename); 44 } 45 46 ESR_ReturnCode SR_AcousticModelsSetParameter(SR_AcousticModels* self, const LCHAR* key, LCHAR* value) 47 { 48 if (self == NULL) 49 { 50 PLogError(L("ESR_INVALID_ARGUMENT")); 51 return ESR_INVALID_ARGUMENT; 52 } 53 return self->setParameter(self, key, value); 54 } 55 56 ESR_ReturnCode SR_AcousticModelsGetParameter(SR_AcousticModels* self, const LCHAR* key, LCHAR* value, size_t* len) 57 { 58 if (self == NULL) 59 { 60 PLogError(L("ESR_INVALID_ARGUMENT")); 61 return ESR_INVALID_ARGUMENT; 62 } 63 return self->getParameter(self, key, value, len); 64 } 65 66 ESR_ReturnCode SR_AcousticModelsGetCount(SR_AcousticModels* self, size_t* size) 67 { 68 if (self == NULL) 69 { 70 PLogError(L("ESR_INVALID_ARGUMENT")); 71 return ESR_INVALID_ARGUMENT; 72 } 73 return self->getCount(self, size); 74 } 75 76 ESR_ReturnCode SR_AcousticModelsGetID(SR_AcousticModels* self, size_t index, SR_AcousticModelID* id, size_t* size) 77 { 78 if (self == NULL) 79 { 80 PLogError(L("ESR_INVALID_ARGUMENT")); 81 return ESR_INVALID_ARGUMENT; 82 } 83 return self->getID(self, index, id, size); 84 } 85 86 ESR_ReturnCode SR_AcousticModelsSetID(SR_AcousticModels* self, size_t index, SR_AcousticModelID* id) 87 { 88 if (self == NULL) 89 { 90 PLogError(L("ESR_INVALID_ARGUMENT")); 91 return ESR_INVALID_ARGUMENT; 92 } 93 return self->setID(self, index, id); 94 } 95