00001 #ifndef ANALOGRECORDER_H_ 00002 #define ANALOGRECORDER_H_ 00003 00004 #include "SimObject.h" 00005 00006 #include <vector> 00007 00008 class AnalogRecorder : public SimObject 00009 { 00010 00011 SIMOBJECT( AnalogRecorder, AdvancePhase::One ) 00012 00013 public: 00014 00015 AnalogRecorder( unsigned samplingTime = 1); 00016 virtual ~AnalogRecorder(); 00017 00018 virtual void setAnalogInput(double v, analog_port_id_t port = 0); 00019 00020 const std::vector<double> & getRecordedValues() const; 00021 00022 virtual int advance(AdvanceInfo const &); 00023 00024 virtual int reset( double dt ); 00025 00026 virtual void setActive(bool active); 00027 00028 void printAnalogValues() const; 00029 00030 virtual double getManagedDelay() const { return 0; } 00031 virtual int nSpikeInputPorts() const { return 0; }; 00032 virtual int nSpikeOutputPorts() const { return 0; }; 00033 virtual int nAnalogInputPorts() const { return 1; }; 00034 virtual int nAnalogOutputPorts() const { return 0; }; 00035 virtual PortType outputPortType(port_t o) const { return undefined; }; 00036 virtual PortType inputPortType(port_t i) const { if( i==0) return analog; else return undefined; }; 00037 00039 unsigned samplingTime; 00040 00041 protected: 00042 double input; 00043 double summationPoint; 00044 std::vector<double> values; 00045 double stepsLeftBeforeSample; 00046 bool isActive; 00047 00048 private: 00049 std::vector<double> & analogVec(); 00050 friend class STandMTAnalogMsgExchangeTest; 00051 friend class DistributedAnalogCommunicationFinalTest; 00052 friend class DistributedSingleThreadNetworkTest; 00053 friend class DistributedMultiThreadNetworkTest; 00054 friend class LocalAnalogMessageDispatchTest; 00055 friend class AnalogRecorderTest; 00056 }; 00057 00058 #endif /*ANALOGRECORDER_H_*/