2022-03-31 21:20:41 +00:00
|
|
|
#include "bus.h"
|
|
|
|
|
|
|
|
namespace domain {
|
|
|
|
|
2022-05-27 06:18:17 +00:00
|
|
|
Wire::Wire(std::string name, WireType type, int width, bool hidden, bool hasTerminate, Value terminateWith)
|
|
|
|
: name(name), type(type), width(width), hidden(hidden), hasTerminate(hasTerminate),
|
|
|
|
terminateWith(terminateWith) {}
|
|
|
|
|
|
|
|
std::string Wire::getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2022-05-30 23:05:08 +00:00
|
|
|
std::string Bus::getInstanceName() {
|
|
|
|
return instanceName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-27 06:18:17 +00:00
|
|
|
int Wire::getWidth() {
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Wire::isHidden() {
|
|
|
|
return hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Wire::hasTerminateWith() {
|
|
|
|
return hasTerminate;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value Wire::getTerminateWith() {
|
|
|
|
return terminateWith;
|
|
|
|
}
|
|
|
|
|
|
|
|
Wire::WireType Wire::getType() {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2022-06-14 19:27:40 +00:00
|
|
|
Bus::Bus(std::string name, std::optional<std::string> displayName, std::string instanceName, std::string tooltip, BusType type, std::pair<int, int> count, std::vector<Wire> wires,
|
2022-05-27 06:18:17 +00:00
|
|
|
std::optional<ui::Bus> displayBus)
|
2022-06-14 19:27:40 +00:00
|
|
|
: name(name), displayName(displayName), instanceName(instanceName), tooltip(tooltip), type(type), count(count), wires(wires), displayBus(displayBus) {}
|
2022-05-27 06:18:17 +00:00
|
|
|
|
|
|
|
std::string Bus::getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2022-06-14 19:27:40 +00:00
|
|
|
std::string Bus::getDisplayName() {
|
|
|
|
if(displayName.has_value()) {
|
|
|
|
return *displayName;
|
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2022-05-27 06:18:17 +00:00
|
|
|
std::string Bus::getTooltip() {
|
|
|
|
return tooltip;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bus::BusType Bus::getType() {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::pair<int, int> Bus::getCount() {
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<Wire> Bus::getWires() {
|
|
|
|
return wires;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::optional<ui::Bus> Bus::getDisplayBus() {
|
|
|
|
return displayBus;
|
|
|
|
}
|
2022-06-14 19:27:40 +00:00
|
|
|
|
2022-03-31 21:20:41 +00:00
|
|
|
} // namespace domain
|