schema_editor/comdel/domain/schema.h

41 lines
827 B
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-07 11:20:09 +00:00
Instance *getInstance(std::string& name) {
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
}
}
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;
}
};
} // namespace domain
#endif // DOMAIN_SCHEMA_H