| 813 | // static |
| 814 | template <class T> |
| 815 | boost::python::class_<FixedVArray<T> > |
| 816 | FixedVArray<T>::register_(const char* doc) |
| 817 | { |
| 818 | boost::python::class_<FixedVArray<T> > fixedVArray_class (name(), doc, |
| 819 | boost::python::init<Py_ssize_t>("Construct a variable array of the " |
| 820 | "specified length initialized to the default value for the given type")); |
| 821 | |
| 822 | fixedVArray_class |
| 823 | .def(boost::python::init<const FixedVArray<T> &>("Construct a variable array with the same values as the given array")) |
| 824 | .def(boost::python::init<const T &, Py_ssize_t>("Construct a variable array of the specified length initialized to the specified default value")) |
| 825 | .def(boost::python::init<const FixedArray<int> &, const T &>("Construct a variable array with each array size equal to the specified elements and initialized to the specified default value")) |
| 826 | .def("__getitem__", &FixedVArray<T>::getslice) |
| 827 | .def("__getitem__", &FixedVArray<T>::getslice_mask) |
| 828 | .def("__getitem__", &FixedVArray<T>::getitem, boost::python::with_custodian_and_ward_postcall<1,0>()) |
| 829 | |
| 830 | .def("__setitem__", &FixedVArray<T>::setitem_scalar) |
| 831 | .def("__setitem__", &FixedVArray<T>::setitem_scalar_mask) |
| 832 | .def("__setitem__", &FixedVArray<T>::setitem_vector) |
| 833 | .def("__setitem__", &FixedVArray<T>::setitem_vector_mask) |
| 834 | |
| 835 | .def("__len__", &FixedVArray<T>::len) |
| 836 | .def("writable", &FixedVArray<T>::writable) |
| 837 | .def("makeReadOnly",&FixedVArray<T>::makeReadOnly) |
| 838 | |
| 839 | .add_property("size", boost::python::make_function(&FixedVArray<T>::getSizeHelper, boost::python::with_custodian_and_ward_postcall<0,1>())) |
| 840 | ; |
| 841 | |
| 842 | { |
| 843 | boost::python::scope s(fixedVArray_class); |
| 844 | |
| 845 | boost::python::class_<typename FixedVArray<T>::SizeHelper,boost::noncopyable> sizeHelper_class ("SizeHelper", boost::python::no_init); |
| 846 | sizeHelper_class |
| 847 | .def("__getitem__", &FixedVArray<T>::SizeHelper::getitem) |
| 848 | .def("__getitem__", &FixedVArray<T>::SizeHelper::getitem_mask) |
| 849 | .def("__getitem__", &FixedVArray<T>::SizeHelper::getitem_slice) |
| 850 | |
| 851 | .def("__setitem__", &FixedVArray<T>::SizeHelper::setitem_scalar) |
| 852 | .def("__setitem__", &FixedVArray<T>::SizeHelper::setitem_scalar_mask) |
| 853 | .def("__setitem__", &FixedVArray<T>::SizeHelper::setitem_vector) |
| 854 | .def("__setitem__", &FixedVArray<T>::SizeHelper::setitem_vector_mask) |
| 855 | ; |
| 856 | } |
| 857 | |
| 858 | boost::python::register_ptr_to_python<boost::shared_ptr<typename FixedVArray<T>::SizeHelper> >(); |
| 859 | |
| 860 | return fixedVArray_class; |
| 861 | } |
| 862 | |
| 863 | |
| 864 | // ---- Explicit Class Instantiation --------------------------------- |
nothing calls this directly
no outgoing calls
no test coverage detected