Skip to content

PyMEOS Architecture

Víctor Diví edited this page Aug 26, 2022 · 9 revisions

PyMEOS Architecture

PyMEOS is a python library that wraps the MEOS C Library providing a set of Python classes that provides all functionality provided by MEOS (well, not really right now, but WIP).

PyMEOS has a 3-layer wrapper architecture with MEOS at its core. The wrappers are divided into two different packages:

  • PyMEOS CFFI Package
    Contains the two inner wrappers that exposes MEOS functionality.
  • PyMEOS Package
    Contains the outer wrapper that provides the Python classes interface.

Each wrapper hides implementation details to improve the usability of the library. These wrappers are divided into two packages

  • CFFI
    The CFFI layer is automatically generated by the CFFI library which results in a shared library that can be imported from python.
  • CFFI Wrapper
    The CFFI wrapper is just a collection of functions that wrap every function exposed by the CFFI wrapper and handles basic type conversion (such as transforming Python's str to C's char *), and some other logic related to the mapping between Python and C types. Although it is not meant to be used directly, it is possible:
from pymeos_cffi import meos_initialize, meos_finish, tbool_in, tbool_out

meos_initialize()
tb = tbool_in('true@2000-1-1')
print(tbool_out(tb))
# t@2000-01-01 00:00:00+01
meos_finish()

Clone this wiki locally