00001 /*************************************************************************** 00002 * @file gnn_null_output.c 00003 * @brief Null Output Set Implementation. 00004 * 00005 * @date : 22-09-03 22:00 00006 * @author : Pedro Ortega C. <peortega@dcc.uchile.cl> 00007 * Copyright 2003 Pedro Ortega C. 00008 ****************************************************************************/ 00009 /* 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 00026 00027 /** 00028 * @defgroup gnn_null_output_doc gnn_null_output : Null Output Device. 00029 * @ingroup gnn_output_doc 00030 * @brief Null output device. 00031 * 00032 * The \ref gnn_null_output datatype is a special device. The output samples 00033 * written to the \ref gnn_null_output stream are automatically deleted. 00034 */ 00035 00036 00037 00038 /******************************************/ 00039 /* Include Files */ 00040 /******************************************/ 00041 00042 #include "gnn_utilities.h" 00043 #include "gnn_null_output.h" 00044 00045 00046 00047 /******************************************/ 00048 /* Static Declaration */ 00049 /******************************************/ 00050 00051 static int 00052 gnn_null_output_put (gnn_output *set, size_t k, const gsl_vector *v); 00053 00054 00055 00056 /******************************************/ 00057 /* Static Implementation */ 00058 /******************************************/ 00059 00060 /** 00061 * @brief The "put" function for a null output set. 00062 * @ingroup gnn_null_output_doc 00063 * 00064 * This function does nothing. 00065 * 00066 * @param set A pointer to a \ref gnn_null_output. 00067 * @param k The index of the pattern to be stored. 00068 * @param v A pointer to the output vector to be stored. 00069 * @return Returns 0 if suceeded. 00070 */ 00071 static int 00072 gnn_null_output_put (gnn_output *set, size_t k, const gsl_vector *v) 00073 { 00074 return 0; 00075 } 00076 00077 00078 00079 00080 /******************************************/ 00081 /* Public Interface */ 00082 /******************************************/ 00083 00084 /** 00085 * @brief Builds a new null output device. 00086 * @ingroup gnn_null_output_doc 00087 * 00088 * This function creates a new \ref gnn_null_output device. 00089 * 00090 * @return Returns a pointer to a new \ref gnn_null_output set. 00091 */ 00092 gnn_output * 00093 gnn_null_output_new () 00094 { 00095 int status; 00096 gnn_output *set; 00097 00098 /* allocate */ 00099 set = (gnn_output *) malloc (sizeof (*set)); 00100 if (set == NULL) 00101 { 00102 GSL_ERROR_VAL ("could not allocate memory for gnn_null_output", 00103 GSL_ENOMEM, NULL); 00104 } 00105 00106 /* initialize */ 00107 status = gnn_output_stream_init (set, NULL, gnn_null_output_put, NULL); 00108 if (status) 00109 { 00110 gnn_output_destroy (set); 00111 GSL_ERROR_VAL ("could not initialize gnn_memory_output", 00112 GSL_EFAILED, NULL); 00113 } 00114 return ; 00115 } 00116 00117
1.2.18