gen.py: add _CCodeGenerator._create_{file_}template() methods
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Aug 2020 15:34:40 +0000 (11:34 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Aug 2020 15:34:40 +0000 (11:34 -0400)
Those new methods create a template (or a file template) using the C
code generator's barectf configuration.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/gen.py

index 4b11fe449ff48df91364b2742bbdc6cbfd303695..0f02f616bcbda0e75f4c04ffade8ceb8a57b2302 100644 (file)
@@ -23,6 +23,7 @@
 
 import barectf.tsdl182gen as barectf_tsdl182gen
 import barectf.templates as barectf_templates
+import barectf.template as barectf_template
 import barectf.codegen as barectf_codegen
 import barectf.config as barectf_config
 import barectf.version as barectf_version
@@ -227,6 +228,12 @@ class _CCodeGenerator:
         self._cg = barectf_codegen._CodeGenerator('\t')
         self._saved_serialization_actions = {}
 
+    def _create_template(self, name: str) -> barectf_template._Template:
+        return barectf_template._Template(name, cfg=self._cfg)
+
+    def _create_file_template(self, name: str) -> barectf_template._Template:
+        return barectf_template._Template(name, True, self._cfg)
+
     @property
     def _trace_type(self):
         return self._cfg.trace.type
This page took 0.023685 seconds and 4 git commands to generate.