Как определить члены данных класса c ++ в оболочке Python - PullRequest
0 голосов
/ 25 апреля 2019

Я пытаюсь написать оболочку Python для файла cpp.Файл cpp состоит из класса, который состоит из определенных пользователем элементов данных, конструкторов и функций-членов.Как я могу определить элементы данных файла cpp в файле оболочки ??

ex.cpp

класс c1

{

public:

    using ct_coeff_type = std::uint64_t;

    using size_type = IntArray<ct_coeff_type>::size_type;

}

Я написал оболочку как

wrapper.cpp

py :: class_ (m, "Ciphertext")

.def(py::init<>())

.def(py::init<const Ciphertext &>())

.def(py::init<MemoryPoolHandle &>())

.def(py::init<std::shared_ptr<SEALContext> &, MemoryPoolHandle &>())

.def(py::init<std::shared_ptr<SEALContext> &, parms_id_type &, MemoryPoolHandle &>())

.def(py::init<std::shared_ptr<SEALContext> &, parms_id_type &, size_type &, MemoryPoolHandle &>())

.def("reserve", (void (Ciphertext::*)(std::shared_ptr<SEALContext> &, parms_id_type &, size_type &)) &Ciphertext::reserve,
    "Allocates enough memory to accommodate the backing array of a ciphertext with given capacity");
...