schema_editor/comdel/domain/bus.h

74 lines
1.3 KiB
C++

#ifndef DOMAIN_BUS_H
#define DOMAIN_BUS_H
#include "display.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 hasTermination;
long long ifUnterminated;
public:
Wire(std::string name, WireType type, int width, bool hidden, bool hasTermination, long long ifUnterminated);
std::string getName();
int getWidth();
bool isHidden();
bool getHasTermination();
long long getIfUnterminated();
WireType getType();
};
class Bus
{
public:
enum BusType {
AUTOMATIC,
REGULAR,
AUTOMATIC_SINGLE
};
private:
std::string name;
std::string tooltip;
BusType type;
std::pair<int, int> count;
std::optional<Display> display;
std::vector<Wire> wires;
public:
Bus(std::string name, std::string tooltip, BusType type, std::pair<int, int> count, std::vector<Wire> wires, std::optional<Display> display = std::nullopt);
std::string getName();
std::string getTooltip();
BusType getType();
std::pair<int, int> getCount();
std::vector<Wire> getWires();
std::optional<Display> getDisplay();
};
} // namespace domain
#endif // DOMAIN_BUS_H