schema_editor/comdel/domain/bus.h

90 lines
1.8 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-05-27 06:18:17 +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;
bool hasTerminate;
Value terminateWith;
public:
Wire(std::string name, WireType type, int width, bool hidden, bool hasTerminate, Value terminateWith);
std::string getName();
int getWidth();
bool isHidden();
bool hasTerminateWith();
Value getTerminateWith();
WireType getType();
2022-04-05 21:48:07 +00:00
};
2022-05-27 06:18:17 +00:00
class Bus {
public:
enum BusType {
AUTOMATIC,
REGULAR,
SINGLE_AUTOMATIC
};
private:
std::string name;
2022-06-14 19:27:40 +00:00
std::optional<std::string> displayName;
std::string instanceName;
2022-05-27 06:18:17 +00:00
std::string tooltip;
BusType type;
std::pair<int, int> count;
std::optional<ui::Bus> displayBus;
std::vector<Wire> wires;
public:
2022-06-14 19:27:40 +00:00
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> display = std::nullopt);
std::string getName();
2022-06-14 19:27:40 +00:00
std::string getDisplayName();
std::string getInstanceName();
2022-05-27 06:18:17 +00:00
std::string getTooltip();
BusType getType();
std::pair<int, int> getCount();
std::vector<Wire> getWires();
2022-04-05 21:48:07 +00:00
2022-05-27 06:18:17 +00:00
std::optional<ui::Bus> getDisplayBus();
2022-03-31 21:20:41 +00:00
};
} // namespace domain
#endif // DOMAIN_BUS_H