# Path: pynusmv/init.py
# def _register_wrapper(wrapper):
#     """
#     Register pointer wrapper to PyNuSMV garbage collector. `wrapper` is
#     stored to be collected before quitting NuSMV.
# 
#     :param wrapper: the pointer wrapper to register
#     :type wrapper: :class:`PointerWrapper <pynusmv.utils.PointerWrapper>`
# 
#     """
#     if __collector is None:
#         raise NuSMVInitError("Cannot register before initializing NuSMV.")
#     else:
#         if __collecting:
#             __collector.add(_WeakWrapper(wrapper, __collector))


from pynusmv_lower_interface.nusmv.utils import utils
from pynusmv.init import _register_wrapper

    """
    Superclass wrapper for NuSMV pointers.

    Every pointer to a NuSMV structure is wrapped in a PointerWrapper
    or in a subclass of PointerWrapper.
    Every subclass instance takes a pointer to a NuSMV structure as constructor
    parameter.

    It is the responsibility of PointerWrapper and its subclasses to free
    the wrapped pointer. Some pointers have to be freed like `bdd_ptr`,
    but other do not have to be freed since NuSMV takes care of this;
    for example, `BddFrm_ptr` does not have to be freed.
    To ensure that a pointer is freed only once, PyNuSMV ensures that
    any pointer is wrapped by only one PointerWrapper (or subclass of it)
    if the pointer have to be freed.

    """

    def __init__(self, pointer, freeit=False):
        """
        Create a new PointerWrapper.

        :param pointer: the pointer to wrap
        :param freeit: whether the pointer has to be freed when this wrapper
                       is destroyed

        """
        self._ptr = pointer
        self._freeit = freeit

# Path: pynusmv/init.py
# def _register_wrapper(wrapper):
#     """
#     Register pointer wrapper to PyNuSMV garbage collector. `wrapper` is
#     stored to be collected before quitting NuSMV.
# 
#     :param wrapper: the pointer wrapper to register
#     :type wrapper: :class:`PointerWrapper <pynusmv.utils.PointerWrapper>`
# 
#     """
#     if __collector is None:
#         raise NuSMVInitError("Cannot register before initializing NuSMV.")
#     else:
#         if __collecting:
#             __collector.add(_WeakWrapper(wrapper, __collector))


# Path: pynusmv/utils.py
from pynusmv_lower_interface.nusmv.utils import utils
from pynusmv.init import _register_wrapper


    """
    Superclass wrapper for NuSMV pointers.

    Every pointer to a NuSMV structure is wrapped in a PointerWrapper
    or in a subclass of PointerWrapper.
    Every subclass instance takes a pointer to a NuSMV structure as constructor
    parameter.

    It is the responsibility of PointerWrapper and its subclasses to free
    the wrapped pointer. Some pointers have to be freed like `bdd_ptr`,
    but other do not have to be freed since NuSMV takes care of this;
    for example, `BddFrm_ptr` does not have to be freed.
    To ensure that a pointer is freed only once, PyNuSMV ensures that
    any pointer is wrapped by only one PointerWrapper (or subclass of it)
    if the pointer have to be freed.

    """

    def __init__(self, pointer, freeit=False):
        """
        Create a new PointerWrapper.

        :param pointer: the pointer to wrap
        :param freeit: whether the pointer has to be freed when this wrapper
                       is destroyed

        """
        self._ptr = pointer
        self._freeit = freeit

        _register_wrapper(self)