From e89c1103ffe05687e21a133f10fcbfeef3b7978d Mon Sep 17 00:00:00 2001 From: Ruslan Garnov Date: Tue, 22 Oct 2019 18:57:31 +0300 Subject: [PATCH] Returned GModel::mkDataNode() overload for external backends --- modules/gapi/src/compiler/gmodel.cpp | 14 ++++++++++++++ modules/gapi/src/compiler/gmodel.hpp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/modules/gapi/src/compiler/gmodel.cpp b/modules/gapi/src/compiler/gmodel.cpp index 74345f16b1..af7b34f05d 100644 --- a/modules/gapi/src/compiler/gmodel.cpp +++ b/modules/gapi/src/compiler/gmodel.cpp @@ -58,6 +58,20 @@ ade::NodeHandle GModel::mkDataNode(GModel::Graph &g, const GOrigin& origin) return data_h; } +ade::NodeHandle GModel::mkDataNode(GModel::Graph &g, const GShape shape) +{ + ade::NodeHandle data_h = g.createNode(); + g.metadata(data_h).set(NodeType{NodeType::DATA}); + + const auto id = g.metadata().get().GetNewId(shape); + GMetaArg meta; + HostCtor ctor; + Data::Storage storage = Data::Storage::INTERNAL; // By default, all objects are marked INTERNAL + + g.metadata(data_h).set(Data{shape, id, meta, ctor, storage}); + return data_h; +} + void GModel::linkIn(Graph &g, ade::NodeHandle opH, ade::NodeHandle objH, std::size_t in_port) { // Check if input is already connected diff --git a/modules/gapi/src/compiler/gmodel.hpp b/modules/gapi/src/compiler/gmodel.hpp index 626770d881..992ae00dca 100644 --- a/modules/gapi/src/compiler/gmodel.hpp +++ b/modules/gapi/src/compiler/gmodel.hpp @@ -231,6 +231,8 @@ namespace GModel GAPI_EXPORTS void init (Graph& g); GAPI_EXPORTS ade::NodeHandle mkOpNode(Graph &g, const GKernel &k, const std::vector& args, const std::string &island); + // Isn't used by the framework or default backends, required for external backend development + GAPI_EXPORTS ade::NodeHandle mkDataNode(Graph &g, const GShape shape); // Adds a string message to a node. Any node can be subject of log, messages then // appear in the dumped .dot file.x