aboutsummaryrefslogtreecommitdiff
path: root/Circuit.h
blob: 05fae495d431e51041d397dd0192d14b70e00f80 (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
#pragma once

#include <string>
#include <vector>
#include <map>

#include "Node.h"
#include "Net.h"

#include "LoopDetection.h"

using std::string;
using std::vector;

class Circuit {
public:
	Circuit() = default;
	virtual ~Circuit();

public:
	//! create a new node or net
	virtual void create(string label, vector<string> nodes);
	//! simulate the circuit
	virtual void sim();
	//! get simulation results as formatted string (probe measure values)
	virtual string result();

private:
	//! specifically create new node
	virtual void new_node(string label, string type);
	//! specifically create a new net
	virtual void new_net(string src, vector<string> dests);

private:
	std::map<string, Node *> nodes = {};
	vector<Net *> nets = {};

	LoopDetection loops = LoopDetection();

	virtual Node * find_node(string label);
};