(****************************************************************** [LibNN - Neural Networks Library] http://libnn.org Copyright (C) 2002 - 2003 LAGACHERIE Matthieu RICORDEAU Olivier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SPECIAL NOTE (the beerware clause): This software is free software. However, it also falls under the beerware special category. That is, if you find this software useful, or use it every day, or want to grant us for our modest contribution to the free software community, feel free to send us a beer from one of your local brewery. Our preference goes to Belgium abbey beers and irish stout (Guiness for strength!), but we like to try new stuffs. Authors: LAGACHERIE Matthieu Paper mail : 7 rue Delescluzes 94280 LE KREMLIN BICETRE, FRANCE E-mail : matthieu@libnn.org RICORDEAU Olivier Paper mail : 69 avenue d'Italie 75013 PARIS, FRANCE E-mail : olivier@libnn.org *****************************************************************) (** The XmlVisitor module @author Matthieu Lagacherie @author Olivier Ricordeau @since 09/02/2003 *) open Nn open DefaultVisitor (** Raised if _overwriteFile is false and one tries to overwrite an existing file. *) exception FileExists (** The abstract XML export visitor. This object exports a neural network as an XML file. @raise FileExists Thrown if _overwriteFile is false, and someone tries to overwrite an existing file. *) class virtual ['a] xmlVisitor : object inherit ['a] defaultVisitor constraint 'a = nn (** The XML file's header. Contains the DTD. @see How to get a DTD whithin a XML file. *) val _header : string (** The XML file's footer. Closes all pending tags. *) val _footer : string (** The name of the .xml file which is to be generated. *) val mutable _fileName : string (** If true, then if _fileName already exists on the disk, it is overwritten during the dump. Otherwise the `FileExists' exception is thrown during the dump. *) val mutable _overwriteFile : bool (** The out_channel used to dump the neural network. stdout is actually never used (since there is a default value for _fileName), but OCaml needs an initial value... *) val mutable _outChannel : out_channel (** Writes a string in the opened file. *) method private write : string -> unit (** Opens a XML tag. *) method private openTag : string -> unit (** CLoses a XML tag. *) method private closeTag : string -> unit (** Dumps a 2d array. *) method private dump2dArray : 'b array -> ('b -> string) -> unit (** Dumps a 3d array. *) method private dump3dArray : float array array -> (float -> string) -> unit (** Dumps a 4d array. *) method private dump4dArray : 'c array array array -> ('c -> string) -> unit (** Dumps a 5d array. *) method private dump5dArray : 'd array array array array -> ('d -> string) -> unit (** The method which creates the XML file with its embedded DTD, and dump stuffs which are inherited from the `nn' class. *) method private beginDump : 'a -> unit (** Closes tags which were opened by beginDump, and close the file. *) method private endDump : 'a -> unit (** The generic visit method. *) method virtual visit : 'a -> unit end