This PR adds pybind11 support for C++ embeddings of the hamming_codecpython module. This allows for a shared object file to be built using the usual cmake installation procedures that can then be linked against in a C++ utility.
C++encode and decode utilities
This PR adds two C++ executables encode and decode that more or less give the same behavior as the python entrypoints for hamming:
$ hamming encode 0x4235 16
0x8a3ac 21
vs.
./build/bin/encode 0x4235 16
0x8a3ac 21
The C++ executables are simple wrappers around the same hamming_codec module functions.
The motivation for wanting to have a standalone C++ shared object is for future utilties that I may build that are purely C++ (e.g. for projects in the ATLAS experiment that may need to encode/decode Hamming encoded quantities within C++ libraries).
Notes
The C++ embedding seems to only work in python<=3.8.2. I could not get it to work properly in python==3.8.5.
The cmake configuration step checks for whether you are in a virtual environment or if there is a defined PYTHONPATH environment, with priority given to the former. From this it bases how to load the hamming_codec module in the C++ hamming_codec wrapper by pre-pending those values to sys.path.
What
This PR adds pybind11 support for
C++
embeddings of thehamming_codec
python
module. This allows for a shared object file to be built using the usualcmake
installation procedures that can then be linked against in aC++
utility.C++
encode
anddecode
utilitiesThis PR adds two
C++
executablesencode
anddecode
that more or less give the same behavior as thepython
entrypoints forhamming
:vs.
The
C++
executables are simple wrappers around the samehamming_codec
module functions.The motivation for wanting to have a standalone
C++
shared object is for future utilties that I may build that are purelyC++
(e.g. for projects in the ATLAS experiment that may need to encode/decode Hamming encoded quantities withinC++
libraries).Notes
The
C++
embedding seems to only work inpython<=3.8.2
. I could not get it to work properly inpython==3.8.5
.The
cmake
configuration step checks for whether you are in a virtual environment or if there is a definedPYTHONPATH
environment, with priority given to the former. From this it bases how to load thehamming_codec
module in the C++ hamming_codec wrapper by pre-pending those values tosys.path
.TODO
Document installation and requirements.