File: vector_wrappers.cpp

package info (click to toggle)
pytango 10.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,304 kB
  • sloc: python: 27,795; cpp: 16,150; sql: 252; sh: 152; makefile: 43
file content (20 lines) | stat: -rw-r--r-- 921 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * SPDX-FileCopyrightText: All Contributors to the PyTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#include "vector_wrappers.h"

// Binding macro
#define BIND_VECTOR_WRAPPER(TYPE)                                                                   \
    py::class_<VectorWrapper<TYPE>, std::shared_ptr<VectorWrapper<TYPE>>>(m, #TYPE "VectorWrapper") \
        .def(py::init<std::vector<TYPE *> *>())                                                     \
        .def("__getitem__", &VectorWrapper<TYPE>::get_item)                                         \
        .def("__setitem__", &VectorWrapper<TYPE>::set_item)                                         \
        .def("append", &VectorWrapper<TYPE>::append)                                                \
        .def("__len__", &VectorWrapper<TYPE>::size);

void export_vector_wrappers(py::module &m) {
    BIND_VECTOR_WRAPPER(Tango::Attr)
}