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 ctai_vector.h 00022 \brief Utilities for working with CTA_Vector objects. 00023 */ 00024 00025 #ifndef NL_VORTECH_CTAI_VECTOR_H 00026 #define NL_VORTECH_CTAI_VECTOR_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 /** \brief Count the number of handles with the given name in the vector (internal use only!) 00032 * 00033 * \param hvec I vector in which to search 00034 * \param name I name of handle(s) to find 00035 * 00036 * \return number of handles counted or -1 in case of an error. 00037 */ 00038 int CTAI_Vector_CountHandles(CTA_Vector hvec, const char* name); 00039 00040 00041 /** \brief Find the handle with the given name (internal use only!) 00042 * 00043 * 00044 * \param hvec I vector in which to search 00045 * \param name I name of handle to find 00046 * 00047 * \return handle or CTA_NULL if not found or in case of an error 00048 */ 00049 CTA_Handle CTAI_Vector_FindHandle(CTA_Vector hvec, const char* name); 00050 00051 00052 /** \brief Get vector value at index i as C string (internal use only!) 00053 * 00054 * \note Free pointer after use. 00055 * 00056 * \param hvec I vector 00057 * \param i I index of value 00058 * 00059 * \return string representation of value at index i of vector 00060 */ 00061 const char *CTAI_Vector_GetStringVal(CTA_Vector hvec, int i); 00062 00063 00064 /** \brief Set vector value at index i giving a C string to be converted to given data type (internal use only!) 00065 * 00066 * \param hvec IO handle of vector 00067 * \param i I index of value to set 00068 * \param val I string representation of value 00069 * \param datatype I data type of value 00070 * 00071 * \return CTA_OK if succesful or CTA_ILLEGAL_DATATYPE if invalid data type 00072 */ 00073 int CTAI_Vector_SetStringVal(CTA_Vector hvec, int i, const char *val, CTA_Datatype datatype); 00074 00075 /** \brief Create a COSTA vector. 00076 * 00077 * \param cur_node I Current XML node 00078 * \return Handle to create or CTA_NULL in case of an error. 00079 */ 00080 CTA_Vector CTAI_XML_CreateVector(xmlNode *cur_node); 00081 00082 /** \brief Generate XML from one COSTA vector 00083 * 00084 * \param hvec I handle of a COSTA vector 00085 * \param writer I the XML text writer 00086 */ 00087 //void CTAI_XML_WriteVector(CTA_Vector hvec, xmlTextWriter *writer); 00088 void CTAI_XML_WriteVector(CTA_Vector hvec, const char *id, const char *caption, CTA_Metainfo minfo, int level, xmlTextWriter *writer); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 #endif