schema_editor/comdel/domain/schema.h

46 lines
1.0 KiB
C
Raw Normal View History

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;
}
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