00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef DISCRETELOGIC_H
00012 #define DISCRETELOGIC_H
00013
00014 #include "component.h"
00015 #include "logic.h"
00016
00017 class Simulator;
00018
00019
00020
00021
00022
00023
00028 class Inverter : public CallbackClass, public Component
00029 {
00030 public:
00031 Inverter( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00032 ~Inverter();
00033
00034 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00035 static LibraryItem *libraryItem();
00036
00037 protected:
00038 void inStateChanged( bool newState );
00039 virtual void drawShape( QPainter &p );
00040
00041 LogicIn * m_pIn;
00042 LogicOut * m_pOut;
00043 };
00044
00049 class Buffer : public CallbackClass, public Component
00050 {
00051 public:
00052 Buffer( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00053 ~Buffer();
00054
00055 static Item* construct(ItemDocument *itemDocument, bool newItem, const char *id);
00056 static LibraryItem *libraryItem();
00057
00058 private:
00059 void inStateChanged( bool newState );
00060 virtual void drawShape( QPainter &p );
00061
00062 LogicIn * m_pIn;
00063 LogicOut * m_pOut;
00064 };
00065
00070 class ECLogicInput : public Component
00071 {
00072 public:
00073 ECLogicInput( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00074 ~ECLogicInput();
00075
00076 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00077 static LibraryItem *libraryItem();
00078 virtual void buttonStateChanged( const QString &id, bool state );
00079
00080 private:
00081 virtual void dataChanged();
00082 virtual void drawShape( QPainter &p );
00083 LogicOut * m_pOut;
00084 bool b_state;
00085 };
00086
00091 class ECLogicOutput : public CallbackClass, public Component
00092 {
00093 public:
00094 ECLogicOutput( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00095 ~ECLogicOutput();
00096
00097 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00098 static LibraryItem *libraryItem();
00099
00100 protected:
00101 void inStateChanged( bool newState );
00102 virtual void drawShape( QPainter &p );
00103
00104 unsigned long long m_lastDrawTime;
00105 unsigned long long m_lastSwitchTime;
00106 unsigned long long m_highTime;
00107 bool m_bLastState;
00108
00109 double m_lastDrawState;
00110 LogicIn * m_pIn;
00111 Simulator * m_pSimulator;
00112 };
00113
00114 #endif