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"
|
2022-06-07 19:13:21 +00:00
|
|
|
#include "library.h"
|
2022-04-05 21:48:07 +00:00
|
|
|
|
2022-06-07 19:13:21 +00:00
|
|
|
#include <utility>
|
2022-04-05 21:48:07 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace domain {
|
|
|
|
|
2022-06-07 19:13:21 +00:00
|
|
|
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 {
|
2022-06-07 19:13:21 +00:00
|
|
|
private:
|
|
|
|
Library library;
|
2022-05-27 06:18:17 +00:00
|
|
|
public:
|
2022-06-07 19:13:21 +00:00
|
|
|
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);
|
2022-06-07 19:13:21 +00:00
|
|
|
|
|
|
|
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
|