schema_editor/comdel/domain/schema.h

48 lines
885 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();
std::vector<Instance*> instances;
std::vector<ConnectionInstance*> connections;
std::vector<WireInstance*> wires;
WireInstance *getWire(std::string name) {
for(auto wire: wires) {
if (wire->name == name) {
return wire;
}
}
return nullptr;
}
bool hasWire(std::string name) {
return getWire(name) != NULL;
}
Instance *getInstance(std::string name) {
for(auto instance: instances) {
if (instance->name == name) {
return instance;
}
}
return nullptr;
}
};
} // namespace domain
#endif // DOMAIN_SCHEMA_H