1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
/***************************************************************************
* Copyright (C) 2004-2005 by David Saxton *
* [email protected] *
* *
* 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
|