Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

connection.h

Go to the documentation of this file.
00001 
00025 #ifndef __CONNECTION_H__
00026 #define __CONNECTION_H__
00027 
00028 #include <magic/mobject.h>
00029 
00030 // Predeclarations
00031 class MagiC::TextOStream;
00032 
00033 class Neuron;       // In neuron.h
00034 class ANNetwork;    // In freenet.h
00035 
00036 
00038 //             ___                                   o                       //
00039 //            /   \        _     _    ___   ___   |           _              //
00040 //            |      __  |/ \  |/ \  /   ) |   \ -+- |  __  |/ \             //
00041 //            |     /  \ |   | |   | |---  |      |  | /  \ |   |            //
00042 //            \___/ \__/ |   | |   |  \__   \__/   \ | \__/ |   |            //
00044 
00050 class Connection : public Object {
00051     decl_dynamic (Connection);
00052 
00053   public:
00054     
00060                             Connection      (const Neuron* source=NULL, const Neuron* target=NULL, double weight=0);
00061                             Connection      (const Connection& orig) {copy (orig);}
00062     virtual                 ~Connection     ();
00063 
00065     inline double           weight              () const {return mWeight;}
00066 
00068     void                    setWeight           (double w) {mWeight = w;}
00069 
00071     void                    operator=			(double w) {mWeight = w;}
00072 
00074     void                    init                (double r=0.0);
00075 
00077     inline const Neuron&    source              () const {return *mpSource;}
00078 
00080     inline Neuron&          source              () {return *mpSource;}
00081 
00083     inline const Neuron&    target              () const {return *mpTarget;}
00084     
00086     inline Neuron&          target              () {return *mpTarget;}
00087     
00089     void                    setSource           (const Neuron* newSource) {mpSource=const_cast<Neuron*>(newSource);}
00090 
00092     void                    setTarget           (const Neuron* newTarget) {mpTarget=const_cast<Neuron*>(newTarget);}
00093 
00095     void                    cut                 () {mpTarget=NULL; mpSource=NULL;}
00096 
00101     virtual double          transfer            ();
00102 
00104     // Implementations
00105 
00107     virtual void            copy                (const Connection& o);
00108     
00110     virtual Connection*     clone               () const {return new Connection (*this);}
00111 
00113     virtual void            check               (int netSize) const;
00114 
00115     virtual void            writeXML            (TextOStream& out) const;
00116     
00117   private:
00119     double      mWeight;
00120 
00121     Neuron* mpSource;
00122     Neuron* mpTarget;
00123     
00124   private:
00125     void operator= (const Connection& other); // Prevent
00126 };
00127 
00128 #endif
00129 

Generated on Thu Feb 10 20:06:44 2005 for Inanna by doxygen1.2.18