www.pudn.com > 基于VC的神经网络开发程序包(源码).rar > Layer.h


#ifndef _LAYER_H 
#define _LAYER_H 
 
#include "Neuron.h" 
#include "Link.h" 
 
namespace annie 
{ 
 
/** Abstraction for a "layer" of neurons, i.e., a group of neurons not 
  * connected to each other. 
  * @see InputLayer 
  */ 
class Layer 
{ 
protected: 
	/// The label of the layer 
	int _label; 
 
	/** The number of neurons in the layer. 
	  * If you create a sub-class of this class, then the onus 
	  * of ensuring that this value is consistent lies on you! 
	  */ 
	int _size; 
 
	/// The neurons in this layer. 
	std::vector _neurons; 
 
public: 
	/** The maximum number of neurons in a layer 
	  * Needed for some automatic label assignments of neurons and layers 
	  * in Networks 
	  */ 
	static const int MAX_LAYER_SIZE; 
 
	/** Constructs a layer with the given label */ 
	Layer(int label); 
 
	virtual ~Layer(); 
 
	/// Returns the label of the layer 
	virtual int getLabel(); 
 
	/// The size of the layer (number of neurons in it) 
	virtual int getSize(); 
 
	/// Adds the given neuron to the layer 
	virtual void addNeuron(Neuron *nrn); 
 
	/** Gives the ith reference in the layer. 
	  * @param i The index of the neuron in the layer (0<=i