aboutsummaryrefslogtreecommitdiff
path: root/docs/class-diag.puml
blob: 4d9f48911c6593ef9d0b476707a4f26fc4472481 (plain)
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
@startuml

skinparam linetype ortho

class Node <<Template>> { /' (also ConcreteObserver) '/
	+Node()
	#Node(const char* type)
	+~Node()
	#output : Net*
	+{abstract} clone() : Node* {query}
	#label : string
	#inputs : vector<Net*>
	+addInput(Net*) : void
	+{abstract} compare() : void
	+setOutput(Net*) : void
	+update() : void

}
class Net { /' (also ConcreteSubject) '/
	+Net()
	+~Net()
	-level : SignalLevel
	+getLevel() : int
	+setLevel(SignalLevel) : void
}

class Subject {
	+size() : int
	-observers : std::vector<Observer*>
	+attach(Observer* obs) : void
	+detach(Observer*) : void
	+notify() : void
}
interface Observer {
	+update() : void
}

class GateAnd {
	-GateAnd(const char* type)
	+GateAnd(const GateAnd* prototype)
	+~GateAnd()
	+clone() : GateAnd* {query}
	-{static} type : constexpr static const char*
	-{static} instance : static GateAnd
	+compare() : void
}
class GateNand
class GateNor
class GateNot
class GateOr
class GateXor
class NodeOutput
class NodeInput

enum SignalLevel {
  LOW
	HIGH
	UNDEFINED
}
Net -- SignalLevel
Node -- SignalLevel

Node <|-[dashed]-- GateAnd
Node <|-[dashed]-- GateNand
Node <|-[dashed]-- GateNor
Node <|-[dashed]-- GateNot
Node <|-[dashed]-- GateOr
Node <|-[dashed]-- GateXor
Node <|-[dashed]-- NodeOutput
Node <|-[dashed]-- NodeInput

class NodeInputLow
class NodeInputHigh
NodeInput <|-- NodeInputLow
NodeInput <|-- NodeInputHigh

Subject <|-- Net
Observer <|-[dashed]- Node
Node -> "owner" Net
Observer "*" - Subject

class ParserException {
	+ParserException(const char* fmt, ...)
	+~ParserException()
	-error : char*
	+what() : char*
}

class Parser {
	+Parser()
	+~Parser()
	-circuit : Circuit*
	-operator<<(Parser& parser, istream s) : istream&
	-operator>>(istream s, Parser& parser) : istream&
	+{static} filter(char* input) : size_t
	+parse(string input) : void
	+parse(istream input) : void
	+set_circuit(Circuit& circuit) : void
}
ParserException - Parser

class NodeFactory {
	+NodeFactory()
	+~NodeFactory()
	+{static} create(string type) : Node*
	-{static} find_type(string type) : Node*
	-{static} get_map() : NodeFactoryMap&
	+{static} has_type(const char* type) : bool
	+{static} has_type(string type) : bool
	-{static} normalize_type(string type) : string
	-{static} assign(const char* type, const Node* node) : void
}

class Circuit {
	+Circuit()
	+~Circuit()
	-find_node(string label) : Node*
	-nodes : std::map<string, Node*>
	-nets : vector<Net*>
	+create(string label, vector<string> nodes) : void
	+new_net(string src, vector<string> dests) : void
	+new_node(string label, string type) : void
}

Circuit ---> Net
Circuit ---> Node

Parser -[dashed]> Circuit

NodeFactory -[dashed]> Node
NodeFactory <-[dashed]- Node


@enduml