Skip to content

Commit

Permalink
WIP #229 start fleshing out processor code for helping with "Actions"
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 committed Mar 26, 2018
1 parent 4958611 commit f990c93
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/common/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit f990c93

Please sign in to comment.