48 lines
885 B
C++
48 lines
885 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<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
|