Exemplo n.º 1
0
 def __init__(self, client, status, reactor):
     """ Initialize the Environment.
         
         @param client:      Environment Client which is responsible for
                             monitoring the environment in this process.
         @type  client:      rce.robot.EnvironmentClient
         
         @param status:      Status observer which is used to inform the
                             Master of the environment's status.
         @type  status:      twisted.spread.pb.RemoteReference
         
         @param reactor:     Reference to the twisted reactor used in this
                             robot process.
         @type  reactor:     twisted::reactor
     """
     self._client = client
     client.registerEnvironment(self)
     
     self._reactor = reactor
     self._loader = Loader()
     
     self._nodes = set()
     self._parameters = set()
     
     Namespace.__init__(self, status)
Exemplo n.º 2
0
    def __init__(self, endpoint, connection):
        """ Initialize the Robot.

            @param endpoint:    Robot Client which is responsible for
                                monitoring the robots in this process.
            @type  endpoint:    rce.robot.RobotClient

            @param connection:  The connection manager for robot namespaces.
            @type  connection:  rce.robot.Connection
        """
        Namespace.__init__(self, endpoint)

        interface_map = {
            Types.encode('PublisherConverter') : PublisherConverter,
            Types.encode('SubscriberConverter') : SubscriberConverter,
            Types.encode('ServiceClientConverter') : ServiceClientConverter,
            Types.encode('ServiceProviderConverter') : ServiceProviderConverter,
            Types.encode('PublisherForwarder') : PublisherForwarder,
            Types.encode('SubscriberForwarder') : SubscriberForwarder,
            Types.encode('ServiceClientForwarder') : ServiceClientForwarder,
            Types.encode('ServiceProviderForwarder') : ServiceProviderForwarder
        }
        self._map.update(interface_map)

        self._connection = connection
Exemplo n.º 3
0
    def __init__(self, endpoint, connection):
        """ Initialize the Robot.

            @param endpoint:    Robot Client which is responsible for
                                monitoring the robots in this process.
            @type  endpoint:    rce.robot.RobotClient

            @param connection:  The connection manager for robot namespaces.
            @type  connection:  rce.robot.Connection
        """
        Namespace.__init__(self, endpoint)

        interface_map = {
            Types.encode('PublisherConverter'): PublisherConverter,
            Types.encode('SubscriberConverter'): SubscriberConverter,
            Types.encode('ServiceClientConverter'): ServiceClientConverter,
            Types.encode('ServiceProviderConverter'): ServiceProviderConverter,
            Types.encode('PublisherForwarder'): PublisherForwarder,
            Types.encode('SubscriberForwarder'): SubscriberForwarder,
            Types.encode('ServiceClientForwarder'): ServiceClientForwarder,
            Types.encode('ServiceProviderForwarder'): ServiceProviderForwarder
        }
        self._map.update(interface_map)

        self._connection = connection
Exemplo n.º 4
0
    def remote_destroy(self):
        """ Method should be called to destroy the environment and will take
            care of destroying all objects owned by this Environment as well
            as deleting all circular references.
        """
        for node in self._nodes.copy():
            node.remote_destroy()

        for parameter in self._parameters.copy():
            parameter.remote_destroy()

        # Can not check here, because nodes are unregistered when the
        # node (process) exits and remote_destroy only requests to stop the
        # node (process)
        #assert len(self._nodes) == 0
        assert len(self._parameters) == 0

        Namespace.remote_destroy(self)
Exemplo n.º 5
0
    def remote_destroy(self):
        """ Method should be called to destroy the environment and will take
            care of destroying all objects owned by this Environment as well
            as deleting all circular references.
        """
        for node in self._nodes.copy():
            node.remote_destroy()

        for parameter in self._parameters.copy():
            parameter.remote_destroy()

        # Can not check here, because nodes are unregistered when the
        # node (process) exits and remote_destroy only requests to stop the
        # node (process)
        #assert len(self._nodes) == 0
        assert len(self._parameters) == 0

        Namespace.remote_destroy(self)
Exemplo n.º 6
0
    def __init__(self, endpoint):
        """ Initialize the Environment.

            @param endpoint:    Environment Client which is responsible for
                                monitoring the environment in this process.
            @type  endpoint:    rce.robot.EnvironmentClient
        """
        Namespace.__init__(self, endpoint)

        interface_map = {
            Types.encode('PublisherInterface'): PublisherInterface,
            Types.encode('SubscriberInterface'): SubscriberInterface,
            Types.encode('ServiceClientInterface'): ServiceClientInterface,
            Types.encode('ServiceProviderInterface'): ServiceProviderInterface
        }
        self._map.update(interface_map)

        self._nodes = set()
        self._parameters = set()
Exemplo n.º 7
0
    def __init__(self, endpoint):
        """ Initialize the Environment.

            @param endpoint:    Environment Client which is responsible for
                                monitoring the environment in this process.
            @type  endpoint:    rce.robot.EnvironmentClient
        """
        Namespace.__init__(self, endpoint)

        interface_map = {
            Types.encode('PublisherInterface') : PublisherInterface,
            Types.encode('SubscriberInterface') : SubscriberInterface,
            Types.encode('ServiceClientInterface') : ServiceClientInterface,
            Types.encode('ServiceProviderInterface') : ServiceProviderInterface
        }
        self._map.update(interface_map)

        self._nodes = set()
        self._parameters = set()
Exemplo n.º 8
0
    def __init__(self, client, reactor):
        """ Initialize the Environment.

            @param client:      Environment Client which is responsible for
                                monitoring the environment in this process.
            @type  client:      rce.robot.EnvironmentClient

            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor
        """
        Namespace.__init__(self)

        self._client = client
        client.registerEnvironment(self)

        self._reactor = reactor
        self._loader = Loader()

        self._nodes = set()
        self._parameters = set()
Exemplo n.º 9
0
 def destroy(self):
     """ # TODO: Add doc
     """
     self._connection = None
     Namespace.remote_destroy(self)
Exemplo n.º 10
0
 def destroy(self):
     """ # TODO: Add doc
     """
     self._connection = None
     Namespace.remote_destroy(self)