Skip to content

Returning None | ndarray from cpp to python #575

Closed Answered by kj4tmp
kj4tmp asked this question in Q&A
Discussion options

You must be logged in to vote
.def("get_iomap", [](SOEM_wrapper &wrapper, uint16_t slave) -> std::tuple<BytesArray, BytesArray> {
            if (slave > wrapper.maxslave) {
                throw std::invalid_argument("requested slave is larger than maxslave.");
            }
            // when viewing master iomap (slave=0). bytecount will be accurate
            if (slave == 0){
                size_t shape_inputs[1] = {wrapper.slavelist[slave].Ibytes};
                size_t shape_outputs[1] = {wrapper.slavelist[slave].Obytes};
                return std::make_tuple(
                    BytesArray(wrapper.slavelist[slave].inputs, 1, shape_inputs, nb::handle()),
                    BytesArray(wrapper.slavelist[slave].

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kj4tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant