Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract DPEs that are instantiated from mixed design/config servers #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated
34 changes: 28 additions & 6 deletions templates/designToConfigParser.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,29 @@ bool {{functionPrefix}}configure{{class_name}} (
{% endif %}
}

string fullName = prefix+name;
bool success = {{functionPrefix}}configureFromName{{class_name}}(name, prefix, createDps, assignAddresses, continueOnError, addressActiveControl, connectionSettings);

dyn_int children;
{% for ho in designInspector.objectify_has_objects(class_name, "[@instantiateUsing='configuration']") %}
children = {{functionPrefix}}getChildNodesWithName(docNum, childNode, "{{ho.get('class')}}");
for (int i=1; i<=dynlen(children); i++)
{{functionPrefix}}configure{{ho.get('class')}} (docNum, children[i], fullName+"/", createDps, assignAddresses, continueOnError, addressActiveControl, connectionSettings);
{% endfor %}

return success;
}

bool {{functionPrefix}}configureFromName{{class_name}} (
string name,
string prefix,
bool createDps,
bool assignAddresses,
bool continueOnError,
mapping addressActiveControl,
mapping connectionSettings)
{
DebugTN("Configure.{{class_name}} called without XML");
string fullName = prefix+name;
string dpt = "{{typePrefix}}{{class_name}}";

Expand Down Expand Up @@ -197,13 +220,12 @@ bool {{functionPrefix}}configure{{class_name}} (
}
}

dyn_int children;
{% for ho in designInspector.objectify_has_objects(class_name, "[@instantiateUsing='configuration']") %}
children = {{functionPrefix}}getChildNodesWithName(docNum, childNode, "{{ho.get('class')}}");
for (int i=1; i<=dynlen(children); i++)
{{functionPrefix}}configure{{ho.get('class')}} (docNum, children[i], fullName+"/", createDps, assignAddresses, continueOnError, addressActiveControl, connectionSettings);
// Parse children instantiated from design
{% for ho in designInspector.objectify_has_objects(class_name, "[@instantiateUsing='design']")%}
{% for obj in ho.object %}
{{functionPrefix}}configureFromName{{ho.get('class')}}("{{obj.get('name')}}", fullName+"/", createDps, assignAddresses, continueOnError, addressActiveControl, connectionSettings);
{% endfor %}
{% endfor %}

}

{% endfor %}
Expand Down