9 #ifndef __HOM_IterableList_h__
10 #define __HOM_IterableList_h__
42 #define GETITEM_SWIG_EXTENSION \
45 %newobject __getitem__; \
46 InterpreterObject __getitem__(int key) \
48 int length = self->__len__(); \
51 if (key < 0 || key >= length) \
53 PyErr_SetString(PyExc_IndexError, "Invalid index"); \
56 return HOMconvertValueForInterpreter( \
57 self->getItemWithValidIndex(key), SWIG_POINTER_OWN); \
61 #define GETITEM_SWIG_EXTENSION
64 #define DEFINE_HOM_ITERABLE_LIST(template_parm, template_type, specialization, getitem_type) \
65 template <template_parm> \
66 class HOM_IterableList specialization \
70 { HOM_CONSTRUCT_OBJECT(this) } \
71 HOM_IterableList(const HOM_IterableList<template_type> &) \
72 { HOM_CONSTRUCT_OBJECT(this) } \
73 virtual ~HOM_IterableList() \
74 { HOM_DESTRUCT_OBJECT(this) } \
78 GETITEM_SWIG_EXTENSION \
80 virtual int __len__() = 0; \
81 virtual std::string __repr__() = 0; \
83 SWIGOUT(%ignore getItemWithValidIndex;) \
84 virtual getitem_type getItemWithValidIndex(int key) = 0; \
92 DEFINE_HOM_ITERABLE_LIST(,
double, <
double>,
double)
93 DEFINE_HOM_ITERABLE_LIST(, std::
string, <std::
string>, std::
string)
95 #undef DEFINE_HOM_ITERABLE_LIST
96 #undef GETITEM_SWIG_EXTENSION
#define DEFINE_HOM_ITERABLE_LIST(template_parm, template_type, specialization, getitem_type)