cta_functions.h

Go to the documentation of this file.
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_functions.h
00022 \brief Functions for working with CTA_Function objects. CTA_Function objects can be used to address functions.
00023 */
00024 
00025 #ifndef CTA_FUNCTIONS_H
00026 #define CTA_FUNCTIONS_H
00027 #include "cta_system.h"
00028 #include "cta_datatypes.h"
00029 #include "cta_handles.h"
00030 #include "cta_interface.h"
00031 #include "ctai_xml.h"
00032 
00033 /* Function Handle */
00034 typedef CTA_Handle CTA_Func;
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /** \brief Create a COSTA function from XML
00041 *          (load from dynamic load library). 
00042 *
00043 *  \param cur_node  I  Current XML node 
00044 *  \return             Handle to create or CTA_NULL in case of an error.
00045 */
00046 CTAEXPORT CTA_Func CTAI_XML_CreateFunc(xmlNode *cur_node);
00047 
00048 
00049 /** \brief Create a new COSTA function.
00050  *
00051  *  \note Argument name is only used for debugging and output.
00052  *
00053  *  \param name     I  name of the new function for debugging purposes
00054  *  \param function I  pointer to function that has to be associated
00055  *                     with new COSTA function
00056  *  \param hintf    I  handle of associated interface
00057  *  \param hfunc    O  receives handle of created COSTA function
00058  *  \return CTA_OK if successful
00059  */
00060 CTAEXPORT int CTA_Func_Create(const char *name, CTA_Function *function , 
00061                     const CTA_Intf hintf, CTA_Func *hfunc);
00062 
00063 
00064 /** \brief Duplicates a user defined function
00065  *
00066  * \param hfunc      I COSTA user function handle
00067  * \param hdupl      I duplication of hfunc
00068  * \return error status: CTA_OK
00069  */
00070 CTAEXPORT int CTA_Func_Duplicate(CTA_Func hfunc, CTA_Func *hdupl);
00071 
00072 
00073 
00074 /** \brief Free a new COSTA function.
00075  *
00076  *  \note 
00077  *
00078  *  \param hfunc  IO handle of COSTA function, replaced by CTA_NULL on return
00079  *  \return CTA_OK if sucessful
00080  */
00081 CTAEXPORT int CTA_Func_Free(CTA_Func *hfunc);
00082 
00083 /** \brief Get interface of COSTA function.
00084  *
00085  *  \note For performance reasons, the interface is not a copy but a handle
00086  *        to the actual interface, it should NOT be freed by the calling routine!
00087  *
00088  *  \param hfunc  I  handle of COSTA function
00089  *  \param hintf  O  receives handle of interface of function
00090  *  \return CTA_OK if successful
00091  */
00092 CTAEXPORT int CTA_Func_GetIntf(const CTA_Func hfunc, CTA_Intf *hintf);
00093 
00094 /** \brief Get function pointer of function
00095  *
00096  *  \note There is no FORTRAN verion of this function available
00097  *
00098  *  \param hfunc     I  handle of COSTA function.
00099  *  \param function  O  receives pointer to function
00100  *  \return CTA_OK if successful
00101  */
00102 CTAEXPORT int CTA_Func_GetFunc(const CTA_Func hfunc, CTA_Function **function);
00103 
00104 /** \brief Get name of function
00105  *
00106  *  \note Future versions will return a COSTA string handle.
00107  *
00108  *  \param hfunc     I  handle of COSTA function.
00109  *  \param name      O  handle of string object that is to receive function name, must exist before calling
00110  *  \return CTA_OK if successful
00111  */
00112 CTAEXPORT int CTA_Func_GetName(const CTA_Func hfunc, CTA_String name);
00113 
00114 /** \brief Set userdata of function
00115  *
00116  *  \note Frees existing user data and replaces it with userdata
00117  *
00118  *  \param hfunc     IO handle of COSTA function.
00119  *  \param userdata  I  new userdata handles
00120  *  \return CTA_OK if successful
00121  */
00122 CTAEXPORT int CTA_Func_SetUserdata(const CTA_Func hfunc, const CTA_Handle userdata );
00123 
00124 /** \brief Get userdata of function
00125  *
00126  *  \param hfunc     I  handle of COSTA function.
00127  *  \param userdata  O  userdata handle
00128  *  \return CTA_OK if successful
00129  */
00130 CTAEXPORT int CTA_Func_GetUserdata(const CTA_Func hfunc, CTA_Handle userdata );
00131 
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135 #endif
00136 

Generated on Mon Apr 6 14:05:58 2009 for COSTA by  doxygen 1.5.2