def __init__(self, st, tree, args): self.st = st self.vs = MainVisitor(st) tree.accept(self.vs) if (len(args) > 0): beStrDef = args[0] else: beStrDef = "standard" # Keep up a port list for each backend bePortLists = {beStrDef: []} for p in self.vs.portList: port, port_name, port_direction, param_name, param_type, param_kind, port_pragmas, port_comments = self.vs.getPortConfiguration( p) beStr = "" for pr in port_comments: #print(pr) if (pr.split(" ")[1] == "middleware"): beStr = string.strip(pr.split( " ")[2]) # Strip trailing and leading whitespace break if (beStr == ""): beStr = beStrDef # No specific backend for this port if (beStr in bePortLists): bePortLists[beStr].append(p) else: bePortLists[beStr] = [p] p.beStr = beStr # Create a list of backends that are used self.beList = {} for beStr in bePortLists: self.beList[beStr] = self.getBackend(beStr, bePortLists[beStr]) # Store the default backend self.beStrDef = beStrDef
def __init__(self, st, tree, args): self.st = st self.vs = MainVisitor(st) tree.accept(self.vs) if (len(args) > 0): beStrDef = args[0] else: beStrDef = "standard" # Keep up a port list for each backend bePortLists = {beStrDef: []} for p in self.vs.portList: port, port_name, port_direction, param_name, param_type, param_kind, port_pragmas, port_comments = self.vs.getPortConfiguration(p) beStr = "" for pr in port_comments: #print(pr) if (pr.split(" ")[1] == "middleware"): beStr = string.strip(pr.split(" ")[2]) # Strip trailing and leading whitespace break if (beStr == ""): beStr = beStrDef # No specific backend for this port if (beStr in bePortLists): bePortLists[beStr].append(p) else: bePortLists[beStr] = [p] p.beStr = beStr # Create a list of backends that are used self.beList = {} for beStr in bePortLists: self.beList[beStr] = self.getBackend(beStr, bePortLists[beStr]) # Store the default backend self.beStrDef = beStrDef
class Main: def __init__(self, st, tree, args): self.st = st self.vs = MainVisitor(st) tree.accept(self.vs) if (len(args) > 0): beStrDef = args[0] else: beStrDef = "standard" # Keep up a port list for each backend bePortLists = {beStrDef: []} for p in self.vs.portList: port, port_name, port_direction, param_name, param_type, param_kind, port_pragmas, port_comments = self.vs.getPortConfiguration(p) beStr = "" for pr in port_comments: #print(pr) if (pr.split(" ")[1] == "middleware"): beStr = string.strip(pr.split(" ")[2]) # Strip trailing and leading whitespace break if (beStr == ""): beStr = beStrDef # No specific backend for this port if (beStr in bePortLists): bePortLists[beStr].append(p) else: bePortLists[beStr] = [p] p.beStr = beStr # Create a list of backends that are used self.beList = {} for beStr in bePortLists: self.beList[beStr] = self.getBackend(beStr, bePortLists[beStr]) # Store the default backend self.beStrDef = beStrDef def getBackend(self, string, portList): if (string == "standard"): return Standard(self.st, self.vs, portList) elif (string == "yarp"): return Yarp(self.st, self.vs, portList) elif (string == "zeromq"): return ZeroMQ(self.st, self.vs, portList) elif (string == "nodejs"): return NodeJS(self.st, self.vs, portList) elif (string == "ros"): return Ros(self.st, self.vs, portList) else: raise Exception("Invalid backend: \"" + string +"\"")
class Main: def __init__(self, st, tree, args): self.st = st self.vs = MainVisitor(st) tree.accept(self.vs) if (len(args) > 0): beStrDef = args[0] else: beStrDef = "standard" # Keep up a port list for each backend bePortLists = {beStrDef: []} for p in self.vs.portList: port, port_name, port_direction, param_name, param_type, param_kind, port_pragmas, port_comments = self.vs.getPortConfiguration( p) beStr = "" for pr in port_comments: #print(pr) if (pr.split(" ")[1] == "middleware"): beStr = string.strip(pr.split( " ")[2]) # Strip trailing and leading whitespace break if (beStr == ""): beStr = beStrDef # No specific backend for this port if (beStr in bePortLists): bePortLists[beStr].append(p) else: bePortLists[beStr] = [p] p.beStr = beStr # Create a list of backends that are used self.beList = {} for beStr in bePortLists: self.beList[beStr] = self.getBackend(beStr, bePortLists[beStr]) # Store the default backend self.beStrDef = beStrDef def getBackend(self, string, portList): if (string == "standard"): return Standard(self.st, self.vs, portList) elif (string == "yarp"): return Yarp(self.st, self.vs, portList) elif (string == "zeromq"): return ZeroMQ(self.st, self.vs, portList) elif (string == "nodejs"): return NodeJS(self.st, self.vs, portList) elif (string == "ros"): return Ros(self.st, self.vs, portList) else: raise Exception("Invalid backend: \"" + string + "\"")