From: Philippe Proulx Date: Thu, 27 Aug 2020 15:34:40 +0000 (-0400) Subject: gen.py: add _CCodeGenerator._create_{file_}template() methods X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=8c7c6ed2a19e78b448a346fe5e4d41169310617b;p=deliverable%2Fbarectf.git gen.py: add _CCodeGenerator._create_{file_}template() methods Those new methods create a template (or a file template) using the C code generator's barectf configuration. Signed-off-by: Philippe Proulx --- diff --git a/barectf/gen.py b/barectf/gen.py index 4b11fe4..0f02f61 100644 --- a/barectf/gen.py +++ b/barectf/gen.py @@ -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