00001 // PulseGen.h --- 00002 // 00003 // Filename: PulseGen.h 00004 // Description: 00005 // Author: Subhasis Ray 00006 // Maintainer: 00007 // Created: Mon Feb 20 01:21:32 2012 (+0530) 00008 // Version: 00009 // Last-Updated: Mon Feb 20 16:42:41 2012 (+0530) 00010 // By: Subhasis Ray 00011 // Update #: 60 00012 // URL: 00013 // Keywords: 00014 // Compatibility: 00015 // 00016 // 00017 00018 // Commentary: 00019 // 00020 // 00021 // 00022 // 00023 00024 // Change log: 00025 // 00026 // 2012-02-20 01:22:01 (+0530) Subha - started porting old moose code 00027 // to dh_branch. 00028 // 00029 00030 // Code: 00031 00032 #ifndef _PULSEGEN_H 00033 #define _PULSEGEN_H 00034 00040 class PulseGen 00041 { 00047 static const int FREE_RUN = 0; 00063 static const int EXT_TRIG = 1; 00068 static const int EXT_GATE = 2; 00069 00070 #ifdef DO_UNIT_TESTS 00071 friend void testPulseGen(); 00072 #endif 00073 public: 00074 PulseGen(); 00075 ~PulseGen(); 00076 00078 // Value field access function definitions 00080 00081 void setFirstDelay(double value ); 00082 double getFirstDelay() const; 00083 void setFirstWidth(double value ); 00084 double getFirstWidth( ) const; 00085 void setFirstLevel(double value ); 00086 double getFirstLevel( ) const; 00087 void setSecondDelay(double value ); 00088 double getSecondDelay( ) const; 00089 void setSecondWidth(double value ); 00090 double getSecondWidth( ) const; 00091 void setSecondLevel(double value ); 00092 double getSecondLevel( ) const; 00093 void setBaseLevel(double value); 00094 double getBaseLevel() const; 00095 void setTrigMode(unsigned int value); 00096 unsigned int getTrigMode() const; 00097 double getOutput() const ; 00098 double getTrigTime() const; 00099 int getPreviousInput() const; 00100 void setCount(unsigned int count); 00101 unsigned int getCount() const; 00102 void setLevel(unsigned int pulseNo, double level); 00103 void setWidth(unsigned int pulseNo, double width); 00104 void setDelay(unsigned int pulseNo, double delay); 00105 double getWidth(unsigned int index) const; 00106 double getDelay(unsigned int index) const; 00107 double getLevel(unsigned int index) const; 00108 00110 // Dest function definitions 00112 00113 void input(double input); 00114 00115 void process( const Eref& e, ProcPtr p ); 00116 00117 void reinit( const Eref& e, ProcPtr p ); 00118 00120 static const Cinfo* initCinfo(); 00121 00122 protected: 00123 vector <double> delay_; 00124 vector <double> level_; 00125 vector <double> width_; 00126 00127 double output_; 00128 double baseLevel_; 00129 double trigTime_; 00130 unsigned int trigMode_; 00131 bool secondPulse_; 00132 00133 int prevInput_; 00134 int input_; 00135 }; 00136 00137 #endif // _PULSEGEN_H 00138 // 00139 // PulseGen.h ends here