<div dir="ltr">I've merged the fixes for the Java and Tcl wrappers so that they can wrap<div>methods that take enum types as parameters.  Together with the python</div><div>fixes, this means that there should be no barrier to people who want to use</div><div>enum types in their class interfaces.</div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 9:17 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks, Marcus.  I've been thinking about Java and Tcl, and I might<div>implement enums in those wrappers via a simple type cast.</div><div><br></div><div>For example,</div><div><br></div><div>  void SetColorMode(ColorModeEnum val);</div><div><br></div><div>would be called from the Tcl and Java wrappers like this</div><div><br></div><div>  SetColorMode(static_cast<ColorModeEnum>(val));</div><div><br></div><div>with no type checking.  It would be much easier to implement</div><div>than making each enum into a first-class type like I've done</div><div>for the Python wrappers.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> - David</div></font></span><div><div class="h5"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 9:01 PM, Marcus D. Hanwell <span dir="ltr"><<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<br>
I will try to take a look soon, travel and proposals have taken up<br>
more of my time than I might like. I am really pleased to see this<br>
added to the Python wrapping (although in truth would love to see it<br>
in Java/Tcl so we could actually use it in our API).<br>
<br>
Marcus<br>
<div><div><br>
On Tue, Dec 2, 2014 at 11:46 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br>
> Still waiting for reviewers for <a href="http://review.source.kitware.com/#/c/17993" target="_blank">http://review.source.kitware.com/#/c/17993</a><br>
> (refactoring the python wrappers and wrapping enum types).  Big thanks<br>
> to Ben for his comments so far.<br>
><br>
>  - David<br>
><br>
><br>
> On Fri, Nov 21, 2014 at 10:58 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br>
>><br>
>> Hi All,<br>
>><br>
>> The enum support for the wrappers is done (pending merge).  The caveat<br>
>> that I mentioned in my previous email no longer applies, i.e. with this<br>
>> new<br>
>> patch _all_ enum types are wrapped, whether they are in the global<br>
>> namespace, in a class namespace, or in any other namespace (except for<br>
>> nested namespaces, which aren't supported by the wrappers yet).<br>
>><br>
>> This change isn't going to have much impact on the VTK core, because<br>
>> most VTK class methods simply take "int" parameters instead of requiring<br>
>> the use of enums.  However, it will have a _big_ impact for the wrapping<br>
>> of third-party VTK classes which tend to use enum parameters quite often.<br>
>> (In fact the change was motivated by the need to wrap some of my own<br>
>> external classes).<br>
>><br>
>> Enum parameter support is only provided for the python wrappers, not for<br>
>> Java or Tcl.<br>
>><br>
>>  - David<br>
>><br>
>><br>
>> On Mon, Nov 17, 2014 at 7:04 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Hi All,<br>
>>><br>
>>> I have a patch in gerrit that modifies the python wrappers so that enum<br>
>>> types are wrapped.  This means that method parameters can be enum<br>
>>> types, something that wasn't possible for wrapped methods before.<br>
>>> <a href="http://review.source.kitware.com/#/c/17993" target="_blank">http://review.source.kitware.com/#/c/17993</a><br>
>>><br>
>>> E.g.:<br>
>>><br>
>>> class vtkSomeObject<br>
>>> {<br>
>>> public:<br>
>>>   enum ColorEnum { Red, Blue };<br>
>>>   void SetColor(enum ColorEnum);<br>
>>> };<br>
>>><br>
>>> Each enum type is wrapped as a unique python type subclassed from<br>
>>> python's "int" type.  So an enum can be used wherever an int can be<br>
>>> used, but methods that take an enum will raise a TypeError unless<br>
>>> given a value of the correct enum type.<br>
>>><br>
>>> One caveat is that this only works if the method and the enum type are<br>
>>> members of the same class.  Sometime later I'll generalize it so that a<br>
>>> method can use an enum defined in a different class, but method & enum<br>
>>> in the same class seems to be the most common use case.<br>
>>><br>
>>> Cheers,<br>
>>><br>
>>>   - David<br></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div>