schema_editor/comdel/domain/bus.h

75 lines
1.4 KiB
C
Raw Normal View History

2022-03-31 21:20:41 +00:00
#ifndef DOMAIN_BUS_H
#define DOMAIN_BUS_H
#include "display.h"
2022-04-24 20:21:45 +00:00
#include "value.h"
2022-03-31 21:20:41 +00:00
#include <string>
#include <optional>
2022-04-05 21:48:07 +00:00
#include <vector>
2022-03-31 21:20:41 +00:00
namespace domain {
2022-04-05 21:48:07 +00:00
class Wire
{
public:
enum WireType {
WIRE_DEFAULT,
WIRED_AND,
WIRED_OR,
R_WIRE
};
private:
std::string name;
WireType type;
int width;
bool hidden;
2022-04-24 20:21:45 +00:00
bool hasTerminate;
Value terminateWith;
2022-04-05 21:48:07 +00:00
public:
2022-04-24 20:21:45 +00:00
Wire(std::string name, WireType type, int width, bool hidden, bool hasTerminate, Value terminateWith);
2022-04-05 21:48:07 +00:00
std::string getName();
int getWidth();
bool isHidden();
2022-04-24 20:21:45 +00:00
bool hasTerminateWith();
Value getTerminateWith();
2022-04-05 21:48:07 +00:00
WireType getType();
};
2022-03-31 21:20:41 +00:00
class Bus
{
public:
enum BusType {
AUTOMATIC,
2022-04-05 21:48:07 +00:00
REGULAR,
SINGLE_AUTOMATIC
2022-03-31 21:20:41 +00:00
};
private:
std::string name;
std::string tooltip;
BusType type;
std::pair<int, int> count;
2022-05-26 17:21:53 +00:00
std::optional<ui::Bus> displayBus;
2022-04-05 21:48:07 +00:00
std::vector<Wire> wires;
2022-03-31 21:20:41 +00:00
public:
2022-05-26 17:21:53 +00:00
Bus(std::string name, std::string tooltip, BusType type, std::pair<int, int> count, std::vector<Wire> wires, std::optional<ui::Bus> display = std::nullopt);
2022-03-31 21:20:41 +00:00
std::string getName();
std::string getTooltip();
BusType getType();
std::pair<int, int> getCount();
2022-04-05 21:48:07 +00:00
std::vector<Wire> getWires();
2022-05-26 17:21:53 +00:00
std::optional<ui::Bus> getDisplayBus();
2022-03-31 21:20:41 +00:00
};
} // namespace domain
#endif // DOMAIN_BUS_H