random_events.utils
===================

.. py:module:: random_events.utils


Classes
-------

.. autoapisummary::

   random_events.utils.SubclassJSONSerializer
   random_events.utils.CPPWrapper


Functions
---------

.. autoapisummary::

   random_events.utils.get_full_class_name
   random_events.utils.recursive_subclasses


Module Contents
---------------

.. py:function:: get_full_class_name(cls)

   Returns the full name of a class, including the module name.

   :param cls: The class.
   :return: The full name of the class


.. py:function:: recursive_subclasses(cls)

   :param cls: The class.
   :return: A list of the classes subclasses.


.. py:class:: SubclassJSONSerializer

   Class for automatic (de)serialization of subclasses.
   Classes that inherit from this class can be serialized and deserialized automatically by calling this classes
   'from_json' method.


   .. py:method:: to_json() -> typing_extensions.Dict[str, typing_extensions.Any]


   .. py:method:: _from_json(data: typing_extensions.Dict[str, typing_extensions.Any]) -> typing_extensions.Self
      :classmethod:

      :abstractmethod:


      Create a variable from a json dict.
      This method is called from the from_json method after the correct subclass is determined and should be
      overwritten by the respective subclass.

      :param data: The json dict
      :return: The deserialized object



   .. py:method:: from_json(data: typing_extensions.Dict[str, typing_extensions.Any]) -> typing_extensions.Self
      :classmethod:


      Create the correct instanceof the subclass from a json dict.

      :param data: The json dict
      :return: The correct instance of the subclass



.. py:class:: CPPWrapper

   Class for wrapping C++ objects.


   .. py:attribute:: _cpp_object
      :type:  typing_extensions.Any

      The C++ object that this class wraps.



   .. py:method:: _from_cpp(cpp_object: typing_extensions.Any) -> typing_extensions.Self
      :abstractmethod:


      Create a new instance of this class from a C++ object.

      This method should also add fields that are python only to the instance that is created.
      This cannot be a class method since the values of the python-only fields are instance-specific.



