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_model_utilities.h 00022 \brief A set of utilities that simplify the creation of COSTA model components. 00023 00024 A set of utility routines. These routines are originally designed for 00025 the rapid development of COSTA model components. But their use is not limited 00026 to model components. 00027 00028 \note This is just a set of utility routines it does not define any COSTA component 00029 00030 */ 00031 00032 00033 #ifndef CTA_MODEL_UTILITIES_H 00034 #define CTA_MODEL_UTILITIES_H 00035 #include "cta_system.h" 00036 #include "cta_handles.h" 00037 #include "cta_datatypes.h" 00038 #include "cta_tree.h" 00039 #include "cta_string.h" 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 /** \brief Handles model configuration tree or name of input xml-file 00046 * 00047 * When a new instance of the a model component is created it needs some 00048 * input. The most convenient way is to provide the root to a COSTA-tree 00049 * with configuration information the name of a XML-configuration file 00050 * This routine will check whether the input handle is a COSTA-tree or 00051 * the name of a XML-configuration file. A COSTA-tree containing the content 00052 * of the XML-file is created when the input is the name of the XML-file. 00053 * 00054 * \note A COSTA-tree is created if the input is the name of an XML-file. 00055 * the handle of the input tree is returned otherwise. This means that 00056 * depending on the input, a tree is created. The routine will return whether 00057 * the returned tree is created by this routine. The caller is responsible 00058 * for freeing the tree when necessary. 00059 * 00060 * \param hinput I handle of tree (CTA_Tree) with model input or string 00061 * (CTA_Sring) with name of xml-input file 00062 * \param tinput O receives handle of tree (CTA_Tree) with model input 00063 * \param cleanup O receives flag (CTA_TRUE/CTA_FALSE) indicating whether tinput is 00064 * created and must be freed by the caller 00065 * 00066 * \return error status: CTA_OK if successful 00067 */ 00068 CTAEXPORT int CTA_Model_Util_InputTree(CTA_Handle hinput, CTA_Tree *tinput, int *cleanup); 00069 00070 #ifdef __cplusplus 00071 } 00072 #endif 00073 #endif 00074 00075 00076