xref: /openbmc/sdbusplus/tools/sdbusplus/signal.py (revision af93b2db)
1from .namedelement import NamedElement
2from .property import Property
3from .renderer import Renderer
4
5
6class Signal(NamedElement, Renderer):
7    def __init__(self, **kwargs):
8        self.properties = [Property(**p) for p in kwargs.pop("properties", [])]
9
10        super(Signal, self).__init__(**kwargs)
11
12    def markdown(self, loader):
13        return self.render(loader, "signal.md.mako", signal=self)
14
15    def cpp_prototype(self, loader, interface, ptype):
16        return self.render(
17            loader,
18            "signal.prototype.hpp.mako",
19            signal=self,
20            interface=interface,
21            ptype=ptype,
22            post=str.rstrip,
23        )
24
25    def cpp_includes(self, interface):
26        return interface.enum_includes(self.properties)
27