From f990c93cb8d369a1d9d2fd1a2c3370e73a1b3138 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Mon, 26 Mar 2018 12:53:14 -0500 Subject: [PATCH] WIP #229 start fleshing out processor code for helping with "Actions" --- src/common/processor.js | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/common/processor.js b/src/common/processor.js index 927b414f..a2520406 100644 --- a/src/common/processor.js +++ b/src/common/processor.js @@ -28,10 +28,13 @@ define([], function() { var orderedTypes = [ 'Message', 'Service', + 'Action', 'External Message', 'External Service', + 'External Action', 'Advertised Message', 'Advertised Service', + 'Advertised Action', 'Link', 'Development Library', 'Source Library', @@ -46,10 +49,13 @@ define([], function() { 'Component': 'makeComponentConvenience', 'Message': 'makeMessageConvenience', 'Service': 'makeServiceConvenience', + 'Action': 'makeActionConvenience', 'External Message': 'makeExternalMessageConvenience', 'External Service': 'makeExternalServiceConvenience', + 'External Action': 'makeExternalActionConvenience', 'Advertised Message': 'makeAdvertisedMessageConvenience', 'Advertised Service': 'makeAdvertisedServiceConvenience', + 'Advertised Action': 'makeAdvertisedActionConvenience', 'External Definitions': 'makeExternalDefinitionsConvenience', 'Link': 'makeLinkConvenience', 'Development Library': 'makeDevelopmentLibraryConvenience', @@ -89,6 +95,13 @@ define([], function() { }); } + if (obj.Action_list) { + obj.Action_list.map(function(o) { + obj.Packages = self.union(obj.Packages, o.Dependencies); + //obj.GenerateMessageDependencies = self.union(obj.GenerateMessageDependencies, o.Dependencies); + }); + } + obj.BuildDependencies = obj.Packages.filter((p) => { return p != obj.name; }); obj.RunDependencies = obj.BuildDependencies; obj.PackageDependencies = obj.BuildDependencies; @@ -137,6 +150,12 @@ define([], function() { if (obj.Server_list) { obj.Server_list.map(function(srv) { tFunc(srv, 'Service'); }); } + if (obj.ActionClient_list) { + obj.ActionClient_list.map(function(cli) { tFunc(cli, 'Action'); }); + } + if (obj.ActionServer_list) { + obj.ActionServer_list.map(function(srv) { tFunc(srv, 'Action'); }); + } // libraries if (obj.Libraries) { obj.Libraries.map(function(lib) { @@ -183,6 +202,18 @@ define([], function() { // get packages that this service is dependent on obj.Dependencies = self.getTypeDependencies(obj.Definition); }, + makeActionConvenience: function(obj, objects) { + var self = this; + var parent = objects[obj.parentPath]; + // make .Package convenience member for rendering code + obj.Package = parent.name; + // make .TypeName convenience member for rendering code + obj.TypeName = obj.name; + // make .AdvertisedName convenience member for rendering code + obj.AdvertisedName = obj.Package + '/' + obj.name; + // get packages that this service is dependent on + obj.Dependencies = self.getTypeDependencies(obj.Definition); + }, makeExternalMessageConvenience: function(obj, objects) { // already will have .Package convenience member for rendering code from model // make .TypeName convenience member for rendering code @@ -197,6 +228,13 @@ define([], function() { // make .AdvertisedName convenience member for rendering code obj.AdvertisedName = obj.Package + '/' + obj.name; }, + makeExternalActionConvenience: function(obj, objects) { + // already will have .Package convenience member for rendering code from model + // make .TypeName convenience member for rendering code + obj.TypeName = obj.name; + // make .AdvertisedName convenience member for rendering code + obj.AdvertisedName = obj.Package + '/' + obj.name; + }, makeAdvertisedMessageConvenience: function(obj, objects) { var TopicType = objects[obj.pointers['Type']]; // make .Package convenience member for rendering code @@ -215,6 +253,15 @@ define([], function() { // make .AdvertisedName convenience member for rendering code obj.AdvertisedName = obj.name; }, + makeAdvertisedActionConvenience: function(obj, objects) { + var TopicType = objects[obj.pointers['Type']]; + // make .Package convenience member for rendering code + obj.Package = TopicType.Package; + // make .TypeName convenience member for rendering code + obj.TypeName = TopicType.name; + // make .AdvertisedName convenience member for rendering code + obj.AdvertisedName = obj.name; + }, makeLinkConvenience: function(obj, objects) { // copy the Link's address to the interface to which it's connected var intf = obj.src;