/* *************************************************************  
 
        Final Project                                 MMU 1996

        ######################################################
        #                                                    #
        #               A Modular Neural Network             #   
        #                                                    #
        #             THE SINGLE NEURON-CELL CLASS           #
        #                                                    #
        ######################################################
   
        Albrecht Schmidt                              09.08.96  
   
        FILE: CCell.h                              Version 1.0
 
   ************************************************************* */
#ifndef _CCell_h
#define _CCell_h

#include "global.h"

/* Class definition for a single NEURON. The Neuron has a number
   of input values, one constant input value, and a output function.

	       w1     ______________
   input1     --------|            |
	       w2     |            |
   input2     --------|            |            __________
		      |            |    net     |        |
   ....               |   SUM      |------------| f(net) |-------- out
	       wN     |            |            |________|
   inputN     --------|            |    
		      |____________|

   
   For each Neuron the vector with the weights, the type of the
   function, and the number of input values is stored.
   For the function cont_bi an cont_uni the parameter lambda
   is stored, which is by default 1.  */


class CCell{
private:                        // The private data of an neuron
	TVector weightV;        // Vector of all weights 
	TVector deltaWeightV;   // Vector of all weights 
	TFunction function;     // The used function
	int no_inputs;          // The number of weights (with ConstInput)
	double lambda;           // The constant for function, DEFAULT = 1


public:
	// Constructor of the Class
	CCell::CCell(int no_inp, TFunction fct);
	// Destructor of the Class
	CCell::~CCell();

	// function to set the delta weight vector in the neuron
	void CCell::SetDeltaWeights(TVector in_weightV);
	// function to get the delta weights of the neuron back
	TVector CCell::GetDeltaWeights(TVector returnV);
	// function to set the weight vector in the neuron
	void CCell::SetWeights(TVector in_weightV);
	// function to get the weights of the neuron back
	TVector CCell::GetWeights(TVector returnV);
	// function to get the weight no of the neuron back
	double CCell::GetWeight(int no);
	
	// function to set the lambda constant
	void CCell::SetLambda(double l);
	// function to get the lambda value of the neuron back
	double CCell::GetLambda();
	
	// function to get the number of inputs
	int CCell::GetNoInputs();

	// function calculates the net value
	double CCell::Net(TVector inputV);
	// function to apply an input vector to the Neuron
	double CCell::Out(TVector inputV);

};
#endif
