schema_editor/comdel/domain/schema.h

43 lines
927 B
C++

#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();
std::vector<shared_ptr<BusInstance>> busInstances;
std::vector<shared_ptr<ComponentInstance>> componentInstances;
std::vector<shared_ptr<ConnectionInstance>> connections;
BusInstance *getBusInstance(std::string& name) {
for(auto& instance: busInstances) {
if (instance->name == name) {
return instance.get();
}
}
return nullptr;
}
ComponentInstance *getComponentInstance(std::string& name) {
for(auto& instance: componentInstances) {
if (instance->name == name) {
return instance.get();
}
}
return nullptr;
}
};
} // namespace domain
#endif // DOMAIN_SCHEMA_H