2022-04-05 21:48:07 +00:00
|
|
|
#ifndef DOMAIN_SCHEMA_H
|
|
|
|
#define DOMAIN_SCHEMA_H
|
|
|
|
|
|
|
|
#include "connectioninstance.h"
|
|
|
|
#include "instance.h"
|
|
|
|
#include "wireinstance.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace domain {
|
|
|
|
|
|
|
|
class Schema
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Schema();
|
|
|
|
|
2022-05-07 12:19:43 +00:00
|
|
|
std::vector<shared_ptr<BusInstance>> busInstances;
|
|
|
|
std::vector<shared_ptr<ComponentInstance>> componentInstances;
|
2022-04-05 21:48:07 +00:00
|
|
|
|
2022-05-07 12:19:43 +00:00
|
|
|
std::vector<shared_ptr<ConnectionInstance>> connections;
|
2022-04-05 21:48:07 +00:00
|
|
|
|
2022-05-08 13:47:47 +00:00
|
|
|
BusInstance *getBusInstance(std::string& name) {
|
2022-05-07 11:20:09 +00:00
|
|
|
for(auto& instance: busInstances) {
|
2022-05-07 12:19:43 +00:00
|
|
|
if (instance->name == name) {
|
|
|
|
return instance.get();
|
2022-05-07 11:20:09 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-08 13:47:47 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
ComponentInstance *getComponentInstance(std::string& name) {
|
2022-05-07 11:20:09 +00:00
|
|
|
for(auto& instance: componentInstances) {
|
2022-05-07 12:19:43 +00:00
|
|
|
if (instance->name == name) {
|
|
|
|
return instance.get();
|
2022-04-05 21:48:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
2022-05-08 22:51:47 +00:00
|
|
|
|
|
|
|
bool hasConnection(string& component, string& pin);
|
|
|
|
ConnectionInstance* getConnection(string& component, string& pin);
|
2022-04-05 21:48:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace domain
|
|
|
|
|
|
|
|
#endif // DOMAIN_SCHEMA_H
|