schema_editor/comdel/domain/bus.h

90 lines
1.8 KiB
C++

#ifndef DOMAIN_BUS_H
#define DOMAIN_BUS_H
#include "display.h"
#include "value.h"
#include <string>
#include <optional>
#include <vector>
namespace domain {
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();
};
class Bus {
public:
enum BusType {
AUTOMATIC,
REGULAR,
SINGLE_AUTOMATIC
};
private:
std::string name;
std::optional<std::string> displayName;
std::string instanceName;
std::string tooltip;
BusType type;
std::pair<int, int> count;
std::optional<ui::Bus> displayBus;
std::vector<Wire> wires;
public:
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,
std::optional<ui::Bus> display = std::nullopt);
std::string getName();
std::string getDisplayName();
std::string getInstanceName();
std::string getTooltip();
BusType getType();
std::pair<int, int> getCount();
std::vector<Wire> getWires();
std::optional<ui::Bus> getDisplayBus();
};
} // namespace domain
#endif // DOMAIN_BUS_H