summaryrefslogtreecommitdiffstats
path: root/src/electronics/components/multiinputgate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/electronics/components/multiinputgate.h')
-rw-r--r--src/electronics/components/multiinputgate.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/src/electronics/components/multiinputgate.h b/src/electronics/components/multiinputgate.h
new file mode 100644
index 0000000..1981217
--- /dev/null
+++ b/src/electronics/components/multiinputgate.h
@@ -0,0 +1,160 @@
+/***************************************************************************
+ * Copyright (C) 2004-2005 by David Saxton *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef MULTIINPUTGATE_H
+#define MULTIINPUTGATE_H
+
+#include "component.h"
+#include "logic.h"
+
+const int maxGateInput = 256;
+
+/**
+@author David Saxton
+*/
+class MultiInputGate : public CallbackClass, public Component
+{
+public:
+ MultiInputGate( ICNDocument *icnDocument, bool newItem, const char *id, int baseWidth = -1 );
+ ~MultiInputGate();
+
+protected:
+ virtual void inStateChanged( bool newState ) = 0;
+ void dataChanged();
+ void updateInputs( int newNum );
+
+ int m_numInputs;
+ int m_baseWidth;
+
+ LogicIn *inLogic[maxGateInput];
+ ECNode *inNode[maxGateInput];
+
+ LogicOut * m_pOut;
+
+ virtual void updateAttachedPositioning();
+
+private:
+ bool b_doneInit;
+};
+
+
+/**
+@short Boolean XNOR
+@author David Saxton
+*/
+class ECXnor : public MultiInputGate
+{
+public:
+ ECXnor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECXnor();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+private:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+
+/**
+@short Boolean XOR
+@author David Saxton
+*/
+class ECXor : public MultiInputGate
+{
+public:
+ ECXor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECXor();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+protected:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+
+/**
+@short Boolean OR
+@author David Saxton
+*/
+class ECOr : public MultiInputGate
+{
+public:
+ ECOr( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECOr();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+protected:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+/**
+@short Boolean NOR
+@author David Saxton
+*/
+class ECNor : public MultiInputGate
+{
+public:
+ ECNor( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECNor();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+private:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+/**
+@short Boolean NAND
+@author David Saxton
+*/
+class ECNand : public MultiInputGate
+{
+public:
+ ECNand( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECNand();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+private:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+/**
+@short Boolean AND
+@author David Saxton
+*/
+class ECAnd : public MultiInputGate
+{
+public:
+ ECAnd( ICNDocument *icnDocument, bool newItem, const char *id = 0L );
+ ~ECAnd();
+
+ static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
+ static LibraryItem *libraryItem();
+
+private:
+ void inStateChanged( bool newState );
+ virtual void drawShape( QPainter &p );
+};
+
+
+
+#endif