00001 /*********************************************************************** 00002 Copyright (C) 2005,2006 Frédéric HENRY <neryel@reveries.info> 00003 00004 This file is part of ASpiReNN. 00005 00006 ASpiReNN is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published 00008 by the Free Software Foundation; either version 2 of the License, 00009 or (at your option) any later version. 00010 00011 ASpiReNN 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 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with ASpiReNN; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00019 02111-1307 USA. 00020 00021 ***********************************************************************/ 00022 00023 #ifndef _NEURON_H_ 00024 #define _NEURON_H_ 00025 00026 #include "object.h" 00027 00051 typedef struct { 00052 aspi_object_t parent; 00053 double v; 00054 } aspi_neuron_t; 00055 00059 typedef struct { 00060 aspi_class_t parent; 00061 void (* act) (aspi_object_t * network); 00062 void (* reinit) (aspi_object_t * network); 00063 } aspi_neuron_class_t; 00064 00065 aspi_object_t * aspi_neuron_init (aspi_object_t * self); 00066 aspi_class_t * aspi_neuron (void); 00067 void aspi_neuron_dtor (aspi_object_t * self); 00068 00069 void aspi_neuron_set_v (aspi_object_t * self, double v); 00070 double aspi_neuron_get_v (aspi_object_t * self); 00071 void aspi_neuron_add_to_v (aspi_object_t * self, double x); 00072 00073 void aspi_neuron_class_act (aspi_class_t * klass, aspi_object_t * network); 00074 void aspi_neuron_class_reinit (aspi_class_t * klass, aspi_object_t * network); 00075 00076 00077 /* Cast an object to aspi_neuron */ 00078 #define ASPI_NEURON(x) (aspi_object_check (x, aspi_neuron ()), ((aspi_neuron_t *) x)) 00079 #define ASPI_NEURON_CLASS(x) (aspi_class_check (x, aspi_neuron ()), ((aspi_neuron_class_t * ) x)) 00080 00083 #endif /* _NEURON_H_ */