3 // Copyright (c) 2014 - Michele De Stefano (micdestefano@users.sourceforge.net)
5 // Distributed under the MIT License (See accompanying file LICENSE)
8 * Instructions for generating and building the extension:
10 * 1. swig -c++ -Wall -python -I../../../include -o indexing_example_wrap.cpp indexing_example.i
12 * 2. python setup.py build
16 * \example indexing_example.i
18 * A simple SWIG interface for a Python extension module that shows the
19 * mds_utils::python::support_random_access and
20 * mds_utils::python::support_random_getset_access usage.
22 * \remarks Here I've used SWIG for convenience only. The
23 * mds_utils::python::FileObj class does not impose you
27 %module indexing_example
29 %include "mds_utils/python/common.i"
30 %include "mds_utils/python/obj.i"
34 #include "indexing_example.hpp"
36 namespace mdspy = mds_utils::python;
41 class Dummy_Container {
48 // The following methods are created as extensions
50 mds_utils::python::Obj __getitem__(mds_utils::python::Obj idx) {
51 return $self->py_get_item(idx);
54 void __setitem__(mds_utils::python::Obj idx,mds_utils::python::Obj val) {
55 $self->py_set_item(idx,val);