schema_editor/comdel/domain/schema.h

52 lines
1.3 KiB
C
Raw Permalink Normal View History

2022-04-05 21:48:07 +00:00
#ifndef DOMAIN_SCHEMA_H
#define DOMAIN_SCHEMA_H
2022-05-27 06:18:17 +00:00
#include "connection_instance.h"
2022-04-05 21:48:07 +00:00
#include "instance.h"
#include "library.h"
2022-04-05 21:48:07 +00:00
#include <utility>
2022-04-05 21:48:07 +00:00
#include <vector>
namespace domain {
struct ConnectionEntry {
enum Type {
BUS,
COMPONENT
};
Type type;
std::optional<BusInstance*> busInstance;
std::optional<ComponentInstance*> componentInstance;
std::optional<Pin> pin;
Connection connection;
};
2022-05-27 06:18:17 +00:00
class Schema {
private:
Library library;
2022-05-27 06:18:17 +00:00
public:
Schema(Library library): library(std::move(library)) {}
2022-05-27 06:18:17 +00:00
std::vector<shared_ptr<BusInstance>> busInstances;
std::vector<shared_ptr<ComponentInstance>> componentInstances;
std::vector<shared_ptr<ConnectionInstance>> connections;
BusInstance *getBusInstance(std::string &name);
ComponentInstance *getComponentInstance(std::string &name);
bool hasConnection(string &component, string &pin);
ConnectionInstance *getConnection(string &component, string &pin);
std::vector<ConnectionEntry> availableConnections(std::string instance, std::string pin, bool onlyConnectable);
2022-06-09 21:42:45 +00:00
vector<ConnectionInstance *> getConnections(string &component, string &pin);
2022-05-27 06:18:17 +00:00
};
2022-04-05 21:48:07 +00:00
} // namespace domain
#endif // DOMAIN_SCHEMA_H