def getPort(self):
"""
Returns a Port object of the same type as the one specified as the
porttype argument during the object instantiation. It uses the
classobj from the new module to generate a class on runtime.
The classobj generates a class using the following arguments:
name: The name of the class to generate
bases: A tuple containing all the base classes to use
dct: A dictionary containing all the attributes such as
functions, and class variables
It is important to notice that the porttype is a BULKIO__POA type and
not a BULKIO type. The reason is because it is used to generate a
Port class that will be returned when the getPort() is invoked. The
returned class is the one acting as a server and therefore must be a
Portable Object Adapter rather and a simple BULKIO object.
"""
# The classobj generates a class using the following arguments:
#
# name: The name of the class to generate
# bases: A tuple containing all the base classes to use
# dct: A dictionary containing all the attributes such as
# functions, and class variables
PortClass = classobj('PortClass',
(self.port_type,),
{'pushPacket':self.pushPacket,
'pushSRI':self.pushSRI})
# Create a port using the generate Metaclass and return an instance
port = PortClass()
return port._this()
评论列表
文章目录