home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-25 | 2.3 KB | 77 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CNeuralNet.h ©1996 Timo Eloranta
- // ===========================================================================
- // An abstract neural net class - derived from LPeriodical to
- // receive a function call (SpendTime()) at regular intervals
-
- #pragma once // Include this header only once
-
- #include "CNeuron.h"
-
- #include <LQueue.h> // PowerPlant queue class
- #include <LPeriodical.h> // PowerPlant "repeater" class
-
- class CNeuroSimPane; // Forward class declaration
-
- class CNeuralNet : public LPeriodical
- {
- protected:
- CNeuron *mMatrix; // Matrix of neurons (array)
-
- Uint16 mSize; // The size of the matrix (mSize x mSize)
-
- LQueue mLightQueue; // A queue of the neurons
- // which are ready to light up
-
- Boolean mDemoMode; // Demo mode: ON or OFF ?
-
- CNeuroSimPane *mPane; // The pane which displays this net
-
- virtual void InitMatrix( const SGenParams & inParams );
-
- virtual void GenerateConnections( CNeuron & inNeuron,
- const SGenParams & inParams ) const;
-
- virtual CNeuronPtr GetRandomReceptor() const;
-
- Boolean ValidLocation( Int16 inCol, Int16 inRow ) const;
-
- public:
- CNeuralNet( Uint16 inSize );
- virtual ~CNeuralNet() {};
-
- virtual CNeuronPtr GetNeuron( Uint16 inCol, Uint16 inRow) const;
-
- Boolean DemoModeOn() const
- { return mDemoMode; };
- void ChangeDemoMode()
- { mDemoMode = (! mDemoMode); };
-
- virtual void SpendTime( const EventRecord &inMacEvent );
-
- virtual void AddToLightQ( LLink * inNeuron );
- virtual void ProcessLightQ();
-
- virtual Uint16 GetNetSize() const
- { return mSize; };
-
- // Pure virtual. Concrete subclasses must override!
- virtual void CreateMatrix() = 0;
-
- // --- Drawing related member functions --- //
-
- virtual void SetPane( CNeuroSimPane * inPane )
- { mPane = inPane; };
-
- virtual void SetNeuronsDirty( const Rect & inRect ) const;
-
- virtual void SetCenterPoints( Uint16 inOneOneXY,
- Uint16 inSquareSize) const;
-
- virtual void RequestDraw() const;
-
- virtual void DrawNeurons( const Rect & inOneOneRect,
- Uint16 inSquareSize) const;
-
- virtual void DrawConnections() const;
- };