| 12 | |
| 13 | namespace chi { |
| 14 | NodeInstance::NodeInstance(GraphFunction* func, std::unique_ptr<NodeType> nodeType, float posX, |
| 15 | float posY, boost::uuids::uuid nodeID) |
| 16 | : mType{std::move(nodeType)}, |
| 17 | mX{posX}, |
| 18 | mY{posY}, |
| 19 | mId{nodeID}, |
| 20 | mContext{&mType->context()}, |
| 21 | mFunction{func}, |
| 22 | mGraphModule{&func->module()} { |
| 23 | assert(mType != nullptr && mFunction != nullptr); |
| 24 | |
| 25 | mType->mNodeInstance = this; |
| 26 | |
| 27 | inputDataConnections.resize(type().dataInputs().size(), {nullptr, ~0ull}); |
| 28 | outputDataConnections.resize(type().dataOutputs().size(), {}); |
| 29 | |
| 30 | if (!type().pure()) { |
| 31 | inputExecConnections.resize(type().execInputs().size(), {}); |
| 32 | outputExecConnections.resize(type().execOutputs().size(), {nullptr, ~0ull}); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | NodeInstance::NodeInstance(const NodeInstance& other, boost::uuids::uuid id) |
| 37 | : mType(other.type().clone()), |