include/lwpr_xml.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 LWPR: A library for incremental online learning
00003 Copyright (C) 2007  Stefan Klanke, Sethu Vijayakumar
00004 Contact: sethu.vijayakumar@ed.ac.uk
00005 
00006 This library is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Lesser General Public
00008 License as published by the Free Software Foundation; either 
00009 version 2.1 of the License, or (at your option) any later version.
00010 
00011 This library is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 Library General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public
00017 License along with this library; if not, write to the Free
00018 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *********************************************************************/
00020 
00021 
00032 #ifndef __LWPR_XML_H
00033 #define __LWPR_XML_H
00034 
00035 #include <stdio.h>
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 
00043 typedef struct {
00044    int level;        
00045    int numSub;       
00046    int curSubNumRF;  
00047    int curSub;       
00048    int curRF;        
00049    int curType;      
00050    void *curPtr;     
00051    int M;            
00052    int MS;           
00053    int N;            
00054    int readM;        
00055    int readN;        
00056    int numErrors;    
00057    int numWarnings;  
00058    FILE *errFile;    
00059    LWPR_Model *model;
00060 } LWPR_ParserData;
00061 
00070 int lwpr_write_xml(const LWPR_Model *model, const char *filename);
00071 
00077 void lwpr_write_xml_fp(const LWPR_Model *model,FILE *fp);
00078 
00096 int lwpr_read_xml(LWPR_Model *model, const char *filename, int *numWarnings);
00097 
00107 void lwpr_xml_write_matrix(FILE *fp, int level, const char *name, 
00108       int M, int Ms, int N, const double *val);
00109 
00117 void lwpr_xml_write_vector(FILE *fp, int level, const char *name, 
00118       int N, const double *val);
00119 
00126 void lwpr_xml_write_int(FILE *fp, int level, const char *name, int val);
00127 
00134 void lwpr_xml_write_scalar(FILE *fp, int level, const char *name, double val);
00135 
00140 void lwpr_xml_write_rf(FILE *fp, const LWPR_ReceptiveField *RF);
00141 
00149 int lwpr_xml_parse_scalar(const char **atts, const char **fieldName);
00150 
00159 int lwpr_xml_parse_vector(const char **atts, const char **fieldName, int *N);
00160 
00170 int lwpr_xml_parse_matrix(const char **atts, const char **fieldName, int *M, int *N);
00171 
00176 void lwpr_xml_error(LWPR_ParserData *ud, const char *msg);
00177 
00184 void lwpr_xml_dim_error(LWPR_ParserData *ud, const char *fieldname,int wishM,int wishN);
00185 
00190 void lwpr_xml_report_unknown(LWPR_ParserData *ud, const char *fieldname);
00191 
00193 void lwpr_xml_start_element(void *userData, const char *name, const char **atts);
00195 void lwpr_xml_end_element(void *userData, const char *name);
00197 void lwpr_xml_handle_data(void *userData, const char *s, int len);
00198 
00207 int lwpr_xml_read_file_into_buffer(const char *filename, char **buffer);
00208 
00209 #ifdef __cplusplus
00210 }
00211 #endif
00212 
00213 #endif

Generated on Wed Apr 2 13:44:42 2008 for LWPR Library by  doxygen 1.4.6