diff --git a/bindings/python/YarpUtilities/include/BipedalLocomotion/bindings/YarpUtilities/VectorsCollection.h b/bindings/python/YarpUtilities/include/BipedalLocomotion/bindings/YarpUtilities/VectorsCollection.h index 101508ef8b..e856c950da 100644 --- a/bindings/python/YarpUtilities/include/BipedalLocomotion/bindings/YarpUtilities/VectorsCollection.h +++ b/bindings/python/YarpUtilities/include/BipedalLocomotion/bindings/YarpUtilities/VectorsCollection.h @@ -19,6 +19,7 @@ namespace YarpUtilities void CreateVectorsCollectionServer(pybind11::module& module); void CreateVectorsCollectionClient(pybind11::module& module); +void CreateVectorsCollectionMetadata(pybind11::module& module); } // namespace YarpUtilities } // namespace bindings diff --git a/bindings/python/YarpUtilities/src/Module.cpp b/bindings/python/YarpUtilities/src/Module.cpp index 2187217a9d..05f310d6db 100644 --- a/bindings/python/YarpUtilities/src/Module.cpp +++ b/bindings/python/YarpUtilities/src/Module.cpp @@ -21,6 +21,7 @@ void CreateModule(pybind11::module& module) CreateVectorsCollectionServer(module); CreateVectorsCollectionClient(module); + CreateVectorsCollectionMetadata(module); } } // namespace IK } // namespace bindings diff --git a/bindings/python/YarpUtilities/src/VectorsCollection.cpp b/bindings/python/YarpUtilities/src/VectorsCollection.cpp index faee792d69..3dd1a101e3 100644 --- a/bindings/python/YarpUtilities/src/VectorsCollection.cpp +++ b/bindings/python/YarpUtilities/src/VectorsCollection.cpp @@ -64,20 +64,52 @@ void CreateVectorsCollectionClient(pybind11::module& module) py::arg("handler")) .def("connect", &VectorsCollectionClient::connect) .def("disconnect", &VectorsCollectionClient::disconnect) - .def("getMetadata", - [](VectorsCollectionClient& impl) -> std::map> + .def("get_metadata", + [](VectorsCollectionClient& impl) -> BipedalLocomotion::YarpUtilities::VectorsCollectionMetadata { BipedalLocomotion::YarpUtilities::VectorsCollectionMetadata metadata; impl.getMetadata(metadata); - return metadata.vectors; + return metadata; }) - .def("readData", + .def("read_data", [](VectorsCollectionClient& impl, bool shouldWait) -> std::map> { BipedalLocomotion::YarpUtilities::VectorsCollection* collection = impl.readData(shouldWait); return collection->vectors; }); } + +void CreateVectorsCollectionMetadata(pybind11::module& module) +{ + namespace py = ::pybind11; + + using namespace ::BipedalLocomotion::YarpUtilities; + + py::class_(module, "VectorsCollectionMetadata") + .def(py::init()) + .def(py::init>&>()) + .def("readWireReader", + [](VectorsCollectionMetadata& impl, yarp::os::idl::WireReader& reader) -> bool { + return impl.read(reader); + }) + .def("readConnectionReader", + [](VectorsCollectionMetadata& impl, yarp::os::ConnectionReader& connection) -> bool { + return impl.read(connection); + }) + .def("writeWireWriter", + [](const VectorsCollectionMetadata& impl, const yarp::os::idl::WireWriter& writer) -> bool { + return impl.write(writer); + }) + .def("writeConnectionWriter", + [](const VectorsCollectionMetadata& impl, yarp::os::ConnectionWriter& connection) -> bool { + return impl.write(connection); + }) + .def("toString", &VectorsCollectionMetadata::toString) + .def("getVectors", + [](const VectorsCollectionMetadata& impl) -> std::map> { + return impl.vectors; + }); +} } // namespace YarpUtilities } // namespace bindings } // namespace BipedalLocomotion