nrnste.h

Go to the documentation of this file.
00001 #ifndef nrnste_h
00002 #define nrnste_h
00003 //StateTransitionEvent is a finite state machine in which a transtion occurs
00004 // when the transition condition is true. For speed the transition condition
00005 // is of the form *var1 > *var2 and allows second order interpolation.
00006 // Transition conditions are checked only if the source state is the
00007 // current state.
00008 
00009 #include <OS/list.h>
00010 
00011 class HocCommand;
00012 class StateTransitionEvent;
00013 
00014 declarePtrList(STEList, StateTransitionEvent)
00015 
00016 class STETransition {
00017 public:
00018    STETransition();
00019    virtual ~STETransition();
00020    boolean condition(double& tr);
00021 
00022    int dest_;
00023    double* var1_;
00024    double* var2_;
00025    double oldval1_;
00026    double oldval2_;
00027    int order_;
00028    HocCommand* stmt_;
00029 };
00030 
00031 class STEState {
00032 public:
00033    STEState();
00034    virtual ~STEState();
00035    int condition(double& tr);
00036    void execute(int);
00037    STETransition* add_transition();
00038    int ntrans_;
00039    STETransition* transitions_;
00040 };
00041 
00042 class StateTransitionEvent {
00043 public:
00044    StateTransitionEvent(int nstate);
00045    virtual ~StateTransitionEvent();
00046    void transition(int src, int dest, double* var1, double* var2,
00047       int order, const char* stmt, Object* obj);
00048    void state(int i){istate_ = i;}
00049    int state(){return istate_;}
00050    int nstate() { return nstate_;}
00051    // return transition index for istate_
00052    //if tr < t then request retreat
00053    int condition(double& tr) { return states_[istate_].condition(tr); }
00054    // make the transition.
00055    void execute(int);
00056    static STEList* stelist_;
00057    static void stelist_change(); // implemented in netcvode.cpp
00058 private:
00059    int nstate_;
00060    int istate_;
00061    STEState* states_;
00062 };
00063 
00064 
00065 #endif
Generated on Mon Jun 13 08:10:26 2011 for NEURON by  doxygen 1.6.3