(****************************************************************** [LibNN - Neural Networks Library] 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. Author: LAGACHERIE Matthieu Paper mail : 7 rue Delescluzes 94280 LE KREMLIN BICETRE, FRANCE E-mail : matthieu@marvinproject.org RICORDEAU Olivier Paper mail : 69 avenue d'Italie 75013 PARIS, FRANCE E-mail : olivier@marvinproject.org *****************************************************************) (** The class Env of the LibNN @author Matthieu Lagacherie @author Olivier Ricordeau This class use the design pattern Singleton in order to provide only one instance of the environment class *) class type environmentType = object method toChannel : string -> unit method setVerbosity : int-> unit end class environment : environmentType = object val mutable _verbosity = 0 val mutable _channel = stderr method toChannel str = Printf.fprintf _channel "%s\n" str method setVerbosity newval = _verbosity <- newval end let env : environmentType option ref = ref None let getEnv() : environmentType = match !env with None -> let result = new environment in env := Some result; result | Some result -> result