Source code for supriya.tools.servertools.ServerObjectProxy

# -*- encoding: utf-8 -*-
import abc
from supriya.tools.systemtools.SupriyaObject import SupriyaObject


[docs]class ServerObjectProxy(SupriyaObject): """ A proxy of an object on a server. Server objects can be allocated and freed. """ ### CLASS VARIABLES ### __slots__ = ( '_server', ) ### INITIALIZER ### @abc.abstractmethod def __init__(self): self._server = None ### PUBLIC METHODS ### @abc.abstractmethod
[docs] def allocate( self, server=None, ): from supriya import servertools assert self.server is None server = server or servertools.Server.get_default_server() assert isinstance(server, servertools.Server) assert server.is_running self._server = server
@abc.abstractmethod
[docs] def free(self): self._server = None
### PUBLIC PROPERTIES ### @abc.abstractproperty def is_allocated(self): raise NotImplementedError @property def server(self): return self._server