00001 /* 00002 COSTA: Problem solving environment for data assimilation 00003 Copyright (C) 2005 Nils van Velzen 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 /** 00021 \file cta_method.h 00022 \brief The interface description of the COSTA method component (this component is still under construction). For user implementation see cta_usr_method.h. 00023 00024 The COSTA method component is provided for calling data assimilation and calibration methods in a uniform way. 00025 */ 00026 00027 #ifndef CTA_METHOD_H 00028 #define CTA_METHOD_H 00029 #include "cta_system.h" 00030 #include "cta_errors.h" 00031 #include "cta_handles.h" 00032 #include "cta_datatypes.h" 00033 #include "cta_functions.h" 00034 00035 /* Method handle */ 00036 typedef CTA_Handle CTA_Method; 00037 typedef CTA_Handle CTA_MethClass; 00038 00039 /* parameters for different functions */ 00040 #define CTA_METH_CREATE_SIZE ( 1) 00041 #define CTA_METH_CREATE_INIT ( 2) 00042 #define CTA_METH_RUN ( 3) 00043 #define CTA_METH_FREE ( 4) 00044 #define CTA_METH_NUMFUNC ( 5) 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 /** \brief Create a new class (=implementation) of a COSTA method. 00051 * 00052 * \param name I name of the new method class 00053 * \param h_func I COSTA function handles for functions that implement class, 00054 * missing functions must have value CTA_NULL 00055 * \param hmethcl O receives handle of new method class 00056 * \return error status: CTA_OK if successful 00057 */ 00058 CTAEXPORT int CTA_Meth_DefineClass(const char *name, const CTA_Func h_func[CTA_METH_NUMFUNC], 00059 CTA_MethClass *hmethcl); 00060 00061 /** \brief Create an instance of a method. 00062 * 00063 * \param hmethcl I method class of new object 00064 * \param userdata IO user data for creation (depends on class) 00065 * \param hmeth O receives handle of new method 00066 * \return error status: CTA_OK if successful 00067 */ 00068 CTAEXPORT int CTA_Meth_Create(CTA_Method hmethcl, CTA_Handle userdata, CTA_Method *hmeth); 00069 00070 /** \brief Run method. 00071 * \param hmeth I handle of method 00072 * \return error status: CTA_OK if successful 00073 */ 00074 CTAEXPORT int CTA_Meth_Run(CTA_Method hmeth); 00075 00076 /** \brief Free the method object. 00077 * 00078 * \Note hmeth=CTA_NULL is allowed 00079 * 00080 * \param hmeth IO handle of method, replaced by CTA_NULL on return. 00081 * \return error status: CTA_OK if successful 00082 */ 00083 CTAEXPORT int CTA_Meth_Free(CTA_Method *hmeth); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif