def addProvidesPort(self, name, type): ports = self.scd.componentfeatures.get_ports() if ports is None: # this is the first port to be added ports = scd.ports() ports.add_provides(scd.provides(providesname=name, repid=type)) self.scd.componentfeatures.set_ports(ports)
def addUsesPort(self, name, type): ports = self.scd.componentfeatures.get_ports() if ports is None: # this is the first port to be added ports = scd.ports() ports.add_uses(scd.uses(usesname=name, repid=type)) self.scd.componentfeatures.set_ports(ports) self._addInterface(type)
def formatSCD(rp, ports): # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ supports_list = [ SInterface(name="PropertyEmitter", id="IDL:CF/PropertyEmitter:1.0", inherits=[scd.inheritsInterface("IDL:CF/PropertySet:1.0")]), SInterface(name="PortSet", id="IDL:CF/PortSet:1.0", inherits=[scd.inheritsInterface("IDL:CF/PortSupplier:1.0") ]), SInterface(name="Logging", id="IDL:CF/Logging:1.0", inherits=[ scd.inheritsInterface("IDL:CF/LogEventConsumer:1.0"), scd.inheritsInterface("IDL:CF/LogConfiguration:1.0") ]), SInterface(name="LogEventConsumer", id="IDL:CF/LogEventConsumer:1.0", inherits=None), SInterface(name="LogConfiguration", id="IDL:CF/LogConfiguration:1.0", inherits=None) ] all_interfaces = rp.scd.get_interfaces() sup_interfaces = rp.scd.get_componentfeatures() for si in supports_list: all_interfaces.add_interface( scd.interface(repid=si.id, name=si.name, inheritsinterface=si.inherits)) # 2020-June-15 - Deactivate redundant support list #sup_interfaces.add_supportsinterface(scd.supportsInterface(repid=si.id, supportsname=si.name)) for interface in all_interfaces.get_interface(): if "Resource" in interface.name: interface.add_inheritsinterface( scd.inheritsInterface("IDL:CF/Logging:1.0")) ports_scd = rp.scd.componentfeatures.get_ports() if ports_scd is None: ports_scd = scd.ports() port_data_types = {} for port in ports: data_type = BLOCK_TO_BULKIO_MAP.get(port.type) if data_type is None: raise Exception("Unknown source block data type: %s" % port.type) repid = "IDL:BULKIO/%s:1.0" % data_type if port.direction.startswith('source'): ports_scd.add_provides( scd.provides(providesname=port.name, repid=repid)) elif port.direction.startswith('sink'): ports_scd.add_uses(scd.uses(usesname=port.name, repid=repid)) else: raise Exception("Unknown block port direction: %s" % port.direction) port_data_types[data_type] = repid for name, repid in port_data_types.items(): all_interfaces.add_interface( scd.interface( repid=repid, name=name, inheritsinterface=[ scd.inheritsInterface( "IDL:BULKIO/ProvidesPortStatisticsProvider:1.0"), scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0") ])) rp.scd.set_interfaces(all_interfaces) rp.scd.set_componentfeatures(sup_interfaces) rp.scd.componentfeatures.set_ports(ports_scd)