Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 67ee314

Browse files
dawagnerkrocard
authored andcommitted
C++ domain generator
Use the newly introduced C++ api to send commands thus avoiding sockets during domain generation from EDD (.pfw). The socket and the python binding have been removed with this rework. The EDD transduction flow is now: EDD ---PFWScriptGenerator.py---> PF commands --domainGenerator.exe--> XML instead of: EDD ---PFWScriptGenerator.py---> python structures --python bindings--> XML Signed-off-by: David Wagner <[email protected]>
1 parent 0631ac2 commit 67ee314

File tree

5 files changed

+358
-228
lines changed

5 files changed

+358
-228
lines changed

test/xml-generator/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29-
if (BUILD_TESTING AND PYTHON_BINDINGS)
29+
if (BUILD_TESTING)
3030

3131
find_package(PythonInterp 2 REQUIRED)
3232

tools/xmlGenerator/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29+
add_executable(domainGeneratorConnector domainGeneratorConnector.cpp)
30+
target_link_libraries(domainGeneratorConnector PRIVATE parameter pfw_utility)
31+
32+
install(TARGETS domainGeneratorConnector RUNTIME DESTINATION bin)
33+
2934
install(PROGRAMS
3035
domainGenerator.sh
3136
domainGenerator.py

tools/xmlGenerator/PFWScriptGenerator.py

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,63 +44,35 @@ def __init__(self):
4444
def getScript(self):
4545
return self._script
4646

47+
def _appendCommand(self, *args):
48+
self._script.append(list(args))
49+
4750
def _doCreateDomain(self, name):
48-
self._script.append(
49-
"{cmd} {domain}".format(
50-
cmd="createDomain",
51-
domain=name))
51+
self._appendCommand("createDomain", name)
5252

5353
def _doSetSequenceAware(self):
54-
self._script.append(
55-
"{cmd} {domain} {aware}".format(
56-
cmd="setSequenceAwareness",
57-
domain=self._ctx_domain,
58-
aware="true"))
54+
self._appendCommand("setSequenceAwareness", self._ctx_domain, "true")
5955

6056
def _doAddElement(self, path):
61-
self._script.append(
62-
"{cmd} {domain} {path}".format(
63-
cmd="addElement",
64-
domain=self._ctx_domain,
65-
path=path))
57+
self._appendCommand("addElement", self._ctx_domain, path)
6658

6759
def _doCreateConfiguration(self, name):
68-
self._script.append(
69-
"{cmd} {domain} {config}".format(
70-
cmd="createConfiguration",
71-
domain=self._ctx_domain,
72-
config=name))
60+
self._appendCommand("createConfiguration", self._ctx_domain, name)
7361

7462
def _doSetElementSequence(self, paths):
75-
self._script.append(
76-
"{cmd} {domain} {config} {paths}".format(
77-
cmd="setElementSequence",
78-
domain=self._ctx_domain,
79-
config=self._ctx_configuration,
80-
paths=" ".join(paths)))
63+
self._appendCommand("setElementSequence", self._ctx_domain, self._ctx_configuration, " ".join(paths))
8164

8265
def _doSetRule(self, rule):
83-
self._script.append(
84-
"{cmd} {domain} {config} {rule}".format(
85-
cmd="setRule",
86-
domain=self._ctx_domain,
87-
config=self._ctx_configuration,
88-
rule=rule))
66+
self._appendCommand("setRule", self._ctx_domain, self._ctx_configuration, rule)
8967

9068
def _doSetParameter(self, path, value):
91-
self._script.append(
92-
"{cmd} {domain} {config} {path} '{value}'".format(
93-
cmd="setConfigurationParameter",
94-
domain=self._ctx_domain,
95-
config=self._ctx_configuration,
96-
path=path,
97-
value=value))
69+
self._appendCommand("setConfigurationParameter", self._ctx_domain, self._ctx_configuration, path, value)
9870

9971
class ArgparseArgumentParser(object) :
10072
"""class that parse command line arguments with argparse library
10173
10274
result of parsing are the class atributs"""
103-
def __init__(self) :
75+
def __init__(self):
10476

10577
myArgParser = argparse.ArgumentParser(description='Process domain scripts.')
10678

0 commit comments

Comments
 (0)