mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00

* initital implementation * datetime replaces with sls::Duration in Python C bindings * using custom type caster * fix for conversion to seconds * added set_count in python * common header for pybind11 includes authored-by: Erik Frojdh <erik.frojdh@psi.ch>
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
/*
|
|
This file contains Python bindings for the IpAddr and MacAddr
|
|
classes.
|
|
*/
|
|
#include "py_headers.h"
|
|
|
|
#include "sls/network_utils.h"
|
|
namespace py = pybind11;
|
|
using sls::IpAddr;
|
|
using sls::MacAddr;
|
|
void init_network(py::module &m) {
|
|
|
|
py::class_<IpAddr>(m, "IpAddr")
|
|
.def(py::init())
|
|
.def(py::init<const std::string &>())
|
|
.def(py::init<uint32_t>())
|
|
.def(py::init<const IpAddr &>())
|
|
.def("hex", &IpAddr::hex)
|
|
.def("uint32", &IpAddr::uint32)
|
|
.def(py::self == py::self)
|
|
.def("__repr__", &IpAddr::str)
|
|
.def("str", &IpAddr::str);
|
|
|
|
py::class_<MacAddr>(m, "MacAddr")
|
|
.def(py::init())
|
|
.def(py::init<const std::string &>())
|
|
.def(py::init<uint64_t>())
|
|
.def(py::init<const MacAddr &>())
|
|
.def("hex", &MacAddr::hex)
|
|
.def(py::self == py::self)
|
|
.def("uint64", &MacAddr::uint64)
|
|
.def("__repr__", &MacAddr::str)
|
|
.def("str", &MacAddr::str);
|
|
}
|