def __init__(self, process): self.process = process self.name = tfs.getName(process) self.type = tfs.getType(process) self.namespace = tfs.getNamespace(process) self.remap = [] self.topic_ports = {}
def getDefaultTopicName(self, thread_port_name, input=False, output=False): if not input and not output: return False, "No direction specified" thread_name = tfs.getName(self.thread) # Ottengo tutte le connesioni di un processo che mappano la porta specificata in process_port_name # del thread associato a questo processo con una porta qualunque del thread. connections = tfs.getAllConnectionsPerPort(self.process, thread_name, thread_port_name, input=input, output=output) names = [] # Per ognuna delle connesioni trovate sopra bisogna cercare la porta verso cui (o da cui) è presente # la connessione e poi cercare la proprietà del topic name su di essa for c in connections: process_port_name = None # Ottengo il nome della porta if input: port_info = tfs.getPortInfoByDestPortInfo(c, thread_name, thread_port_name) (process_name, process_port_name) = tfs.getSourceFromPortInfo(port_info) elif output: port_info = tfs.getPortInfoBySourcePortInfo(c, thread_name, thread_port_name) (process_name, process_port_name) = tfs.getDestFromPortInfo(port_info) # La porta è una feature, quindi si usa getFeatureByName process_port = tfs.getFeatureByName(self.process, process_port_name) (topic_namespace, topic_name) = tfs.getDefaultTopicName(process_port) if topic_namespace is None or topic_name is None: return False, "Unable to get topic name" names.append(topic_name) # Rimuovo i duplicati names = list(set(names)) if len(names) < 1: return False, "No topic name defined" if len(names) > 1: return False, "Multiple topic names defined" self.topic = names[0] return True, ""
def __init__(self, _system_root, _process, _thread, _associated_class): # AADLProcess a cui un AADLThread fa riferimento self.associated_class = _associated_class # Processo e thread relativi self.system_root = _system_root self.process = _process self.thread = _thread # Tipo thread self.type = tfs.getType(self.thread) # Nome del thread self.name = tfs.getName(self.thread) # TF self.thread_uses_tf = False