probe.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef PROBE_H
00012 #define PROBE_H
00013 
00014 #include <component.h>
00015 
00016 class LogicProbeData;
00017 class ProbeData;
00018 class FloatingProbeData;
00019 
00023 class Probe : public Component
00024 {
00025         public:
00026                 Probe( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00027                 ~Probe();
00028         
00029         protected:
00030                 virtual void dataChanged();
00031                 
00032                 ProbeData * p_probeData; // As obtained via registering with the oscilloscope
00033                 QColor m_color;
00034 };
00035 
00039 class FloatingProbe : public Probe
00040 {
00041         public:
00042                 FloatingProbe( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00043                 ~FloatingProbe();
00044         
00045                 virtual bool doesStepNonLogic() const { return true; }
00046                 
00047         protected:
00048                 virtual void dataChanged();
00049                 virtual void drawShape( QPainter &p );
00050                 
00051                 FloatingProbeData * m_pFloatingProbeData;
00052 };
00053 
00057 class VoltageProbe : public FloatingProbe
00058 {
00059         public:
00060                 VoltageProbe( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00061                 ~VoltageProbe();
00062         
00063                 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00064                 static LibraryItem *libraryItem();
00065                 
00066                 virtual void stepNonLogic();
00067                 
00068         protected:
00069                 Pin * m_pPin1;
00070                 Pin * m_pPin2;
00071 };
00072 
00076 class CurrentProbe : public FloatingProbe
00077 {
00078         public:
00079                 CurrentProbe( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00080                 ~CurrentProbe();
00081         
00082                 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00083                 static LibraryItem *libraryItem();
00084                 
00085                 virtual void stepNonLogic();
00086                 
00087         protected:
00088                 VoltageSource *m_voltageSource;
00089 };
00090 
00094 class LogicProbe : public CallbackClass, public Probe
00095 {
00096         public:
00097                 LogicProbe( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00098                 ~LogicProbe();
00099         
00100                 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00101                 static LibraryItem *libraryItem();
00102         
00103                 void logicCallback( bool value );
00104         
00105         protected:
00106                 virtual void drawShape( QPainter &p );
00107                 
00108                 LogicProbeData * p_logicProbeData;
00109                 LogicIn * m_pIn;
00110                 Simulator * m_pSimulator;
00111 };
00112 
00113 #endif

Generated on Tue May 8 17:05:32 2007 for KTechLab by  doxygen 1.5.1