aboutsummaryrefslogtreecommitdiff
path: root/docs/class-diag.puml
blob: 3c572bd6f80bd92bbff8675f57f8b1fb7aa3fc4c (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
@startuml

abstract class Node { /' (also ConcreteObserver) '/
	+ setOutput(Net*)
	+ addInput(Net*)
	- inputs: Net*[]
	- output: Net*
	- type: static const char * string
	- minInputs: constexpr unsigned int
	- maxInputs: constexpr int
}
class Net { /' (also ConcreteSubject) '/
	- level: SignalLevel
	+ setLevel(SignalLevel)
	' only call notify when setLevel actually changes the level!!!!!!!
}

class Subject {
	- observers: Observer*[]
	+ attach(Observer*)
	+ detach(Observer*)
	+ notify()
}
interface Observer {
	+ update()
}

class GateAnd
class GateNand
class GateNor
class GateNot
class GateOr
class GateXor
class NodeOutput
class NodeInput

enum SignalLevel {
  LOW
	HIGH
	UNDEFINED
}

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

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

class Parser {
	+ loadFromFile()
}

class CircuitFactory {
	+ run()
	+ configure()
}

class Circuit {
	+ createNode(string type, string label)
	+ createLink(string labelA, string labelB)

	- nets: vector<Net*>
	- nodes: Map<string label, Node*>
}

CircuitFactory -[dashed]> Node
CircuitFactory <-[dashed]- Node


@enduml