AnalogDelayObject.h

Go to the documentation of this file.
00001 #ifndef ANALOGDELAYOBJECT_H_
00002 #define ANALOGDELAYOBJECT_H_
00003 
00004 #include <string>
00005 using std::string;
00006 
00007 #include "SimObject.h"
00008 #include "CircularQueue.h"
00009 
00010 class AnalogDelayObject : public SimObject
00011 {
00012 
00013     SIMOBJECT( AnalogDelayObject, AdvancePhase::Two )
00014 
00015 public:
00016     AnalogDelayObject(delay_t minimumDelay = 1);
00017 
00018     virtual ~AnalogDelayObject();
00019 
00020     virtual void setAnalogInput(double v, analog_port_id_t port = 0);
00021 
00022     virtual double getAnalogOutput(analog_port_id_t port = 0) const;
00023 
00024     void announceDelayedRead(delay_t delay);
00025 
00026     virtual int advance(AdvanceInfo const &);
00027 
00028     virtual int init(InitializeInfo *ii);
00029 
00030     virtual int reset( double dt );
00031 
00032     virtual int getFieldOffset(string fieldname);
00033 
00034 /*    virtual double  getLastSpikeTime()
00035     {
00036         return -1;
00037     };
00038 
00039     virtual bool  firedQ()
00040     {
00041         return false;
00042     };
00043 */
00044     void advanceCycle();
00045 
00046     double getCycledAnalogOutput(int delay)
00047     {
00048         // cerr << "delayer " << this << " : get cycled analog output value = " << delay_queue->getFromMark(delay) <<
00049         //      " delay = " << delay << endl;
00050         return delay_queue->getFromMark(delay);
00051     };
00052 
00053     bool isScheduledForAdvanceCycle()
00054     {
00055         return addedForAdvanceCycle;
00056     }
00057 
00058     void setAddedForAdvanceCycle()
00059     {
00060         addedForAdvanceCycle = true;
00061     }
00062 
00063     void putNewCycleValues(double *val)
00064     {
00065         delay_queue->putArray(val, minDelay);
00066         delay_queue->moveMark(minDelay);
00067     }
00068 
00069         int initDistributedMode();
00070 
00071 protected:
00072     CircularQueue<double>* delay_queue;
00073 
00074     delay_t minDelay;
00075 
00076     delay_t maxDelay;
00077 
00078         friend class SimObjectTypeTest;
00079     double input;
00080 
00081     double output;
00082 
00083     bool addedForAdvanceCycle;
00084 
00085 };
00086 
00087 typedef AnalogDelayObject IncomingAnalogDelayObject;
00088 
00089 #endif /*ANALOGDELAYOBJECT_H_*/

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5