CSIM: iongate.h Source File

iongate.h

00001 #ifndef __IONGATE_H__
00002 #define __IONGATE_H__
00003 
00004 #include <math.h>
00005 #include <stdlib.h>
00006 #include "advanceable.h"
00007 #include "membranepatchsimple.h"
00008 
00009 #define IONGATE_TABLES(_className_) /* this must be included by each class derived from IonGate */ \
00010 protected: \
00011  \
00012  virtual double *getC1(void) { return C1; } \
00013  virtual double *getC2(void) { return C2; } \
00014  virtual void setC1(double *p) { C1=p; } \
00015  virtual void setC2(double *p) { C2=p; } \
00016  \
00017  static   double *C1; \
00018  \
00019  static   double *C2; \
00020  \
00021  \
00022 public: \
00023  ~_className_(void) { \
00024    if (getC1()) { free(getC1()); setC1(0); } \
00025    if (getC2()) { free(getC2()); setC2(0); } \
00026  }
00027 
00029 /*
00030  ** Missing
00031  **
00032  ** */
00033 class IonGate : public Advancable {
00034 
00035 public:
00037   IonGate(void) { k=1;  P=0;  c1=0;  c2=0;  p=0; };
00038 
00039   // NOTE: The destructor comes within the macro IONGATE_TABLES
00040 
00042   virtual void reset(void) {};
00043 
00045   virtual int updateInternal(void) {return 0;};
00046 
00048   virtual int advance(void) {return 0;};
00049 
00050   virtual double pInfty(MembranePatchSimple *) { return 0;}
00051 
00052   virtual int addIncoming(Advancable *a);
00053 
00054   virtual int addOutgoing(Advancable *a);
00055 
00057   virtual void ConnectToMembrane(MembranePatchSimple *) { return;}
00058 
00060   int k;
00061 
00063   double P;
00064 
00065 protected:
00066 
00067   IONGATE_TABLES(IonGate);
00068 
00070   double *c1;
00072   double *c2;
00073 
00075   double p;
00076 };
00077 
00078 #endif
00079 
00080 
00081 

 
(C) 2003, Thomas Natschläger last modified 07/10/2006