50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#ifndef DOMAIN_SCHEMA_H
|
|
#define DOMAIN_SCHEMA_H
|
|
|
|
#include "connection_instance.h"
|
|
#include "instance.h"
|
|
#include "library.h"
|
|
|
|
#include <utility>
|
|
#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;
|
|
};
|
|
|
|
class Schema {
|
|
private:
|
|
Library library;
|
|
public:
|
|
Schema(Library library): library(std::move(library)) {}
|
|
|
|
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);
|
|
};
|
|
|
|
} // namespace domain
|
|
|
|
#endif // DOMAIN_SCHEMA_H
|