SimObject.py (12035:7b8e1b36875d) SimObject.py (12036:634fbd07bc88)
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 687 unchanged lines hidden (view full) ---

696
697static void
698module_init(py::module &m_internal)
699{
700 py::module m = m_internal.def_submodule("param_${cls}");
701''')
702 code.indent()
703 if cls._base:
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 687 unchanged lines hidden (view full) ---

696
697static void
698module_init(py::module &m_internal)
699{
700 py::module m = m_internal.def_submodule("param_${cls}");
701''')
702 code.indent()
703 if cls._base:
704 code('py::class_<${cls}Params, ${{cls._base.type}}Params>(m, ' \
705 '"${cls}Params")')
704 code('py::class_<${cls}Params, ${{cls._base.type}}Params, ' \
705 'std::unique_ptr<${{cls}}Params, py::nodelete>>(' \
706 'm, "${cls}Params")')
706 else:
707 else:
707 code('py::class_<${cls}Params>(m, "${cls}Params")')
708 code('py::class_<${cls}Params, ' \
709 'std::unique_ptr<${cls}Params, py::nodelete>>(' \
710 'm, "${cls}Params")')
708
709 code.indent()
710 if not hasattr(cls, 'abstract') or not cls.abstract:
711 code('.def(py::init<>())')
712 code('.def("create", &${cls}Params::create)')
713
714 param_exports = cls.cxx_param_exports + [
715 PyBindProperty(k)

--- 8 unchanged lines hidden (view full) ---

724 code(';')
725 code()
726 code.dedent()
727
728 bases = [ cls._base.cxx_class ] + cls.cxx_bases if cls._base else \
729 cls.cxx_bases
730 if bases:
731 base_str = ", ".join(bases)
711
712 code.indent()
713 if not hasattr(cls, 'abstract') or not cls.abstract:
714 code('.def(py::init<>())')
715 code('.def("create", &${cls}Params::create)')
716
717 param_exports = cls.cxx_param_exports + [
718 PyBindProperty(k)

--- 8 unchanged lines hidden (view full) ---

727 code(';')
728 code()
729 code.dedent()
730
731 bases = [ cls._base.cxx_class ] + cls.cxx_bases if cls._base else \
732 cls.cxx_bases
733 if bases:
734 base_str = ", ".join(bases)
732 code('py::class_<${{cls.cxx_class}}, ${base_str}>(m, ' \
733 '"${py_class_name}")')
735 code('py::class_<${{cls.cxx_class}}, ${base_str}, ' \
736 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \
737 'm, "${py_class_name}")')
734 else:
738 else:
735 code('py::class_<${{cls.cxx_class}}>(m, "${py_class_name}")')
739 code('py::class_<${{cls.cxx_class}}, ' \
740 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \
741 'm, "${py_class_name}")')
736 code.indent()
737 for exp in cls.cxx_exports:
738 exp.export(code, cls.cxx_class)
739 code(';')
740 code.dedent()
741 code()
742 code.dedent()
743 code('}')

--- 812 unchanged lines hidden ---
742 code.indent()
743 for exp in cls.cxx_exports:
744 exp.export(code, cls.cxx_class)
745 code(';')
746 code.dedent()
747 code()
748 code.dedent()
749 code('}')

--- 812 unchanged lines hidden ---