// Maps %include %fragment("StdMapTraits","header",fragment="StdSequenceTraits") { namespace swig { template inline void assign(const OctSeq& octseq, std::map *map) { typedef typename std::map::value_type value_type; typename OctSeq::const_iterator it = octseq.begin(); for (;it != octseq.end(); ++it) { map->insert(value_type(it->first, it->second)); } } template struct traits_asptr > { typedef std::map map_type; static int asptr(octave_value obj, map_type **val) { /* int res = SWIG_ERROR; if (PyDict_Check(obj)) { SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { map_type *p; res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info(),0); if (SWIG_IsOK(res) && val) *val = p; } return res; */ return SWIG_ERROR; } }; template struct traits_from > { typedef std::map map_type; typedef typename map_type::const_iterator const_iterator; typedef typename map_type::size_type size_type; static octave_value from(const map_type& map) { /* swig_type_info *desc = swig::type_info(); if (desc && desc->clientdata) { return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN); } else { size_type size = map.size(); int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1; if (pysize < 0) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; } PyObject *obj = PyDict_New(); for (const_iterator i= map.begin(); i!= map.end(); ++i) { swig::SwigVar_PyObject key = swig::from(i->first); swig::SwigVar_PyObject val = swig::from(i->second); PyDict_SetItem(obj, key, val); } return obj; } */ return octave_value(); } }; template struct from_key_oper { typedef const ValueType& argument_type; typedef octave_value result_type; result_type operator()(argument_type v) const { return swig::from(v.first); } }; template struct from_value_oper { typedef const ValueType& argument_type; typedef octave_value result_type; result_type operator()(argument_type v) const { return swig::from(v.second); } }; template struct OctMapIterator_T : SwigPyIteratorClosed_T { OctMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, octave_value seq) : SwigPyIteratorClosed_T(curr, first, last, seq) { } }; template > struct OctMapKeyIterator_T : OctMapIterator_T { OctMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, octave_value seq) : OctMapIterator_T(curr, first, last, seq) { } }; template inline SwigPyIterator* make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, octave_value seq = octave_value()) { return new OctMapKeyIterator_T(current, begin, end, seq); } template > struct OctMapValueIterator_T : OctMapIterator_T { OctMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, octave_value seq) : OctMapIterator_T(curr, first, last, seq) { } }; template inline SwigPyIterator* make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, octave_value seq = 0) { return new OctMapValueIterator_T(current, begin, end, seq); } } } %define %swig_map_common(Map...) %swig_sequence_iterator(Map); %swig_container_methods(Map); %enddef %define %swig_map_methods(Map...) %swig_map_common(Map) %enddef %include