PageRenderTime 675ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/python/operator/example.i

#
Swig | 28 lines | 14 code | 7 blank | 7 comment | 0 complexity | 18eb5f303b9d2ec817c4fcfa82d16c00 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.i */
  2. %module example
  3. #pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
  4. %{
  5. #include "example.h"
  6. %}
  7. /* This header file is a little tough to handle because it has overloaded
  8. operators and constructors. We're going to try and deal with that here */
  9. /* This turns the copy constructor in a function ComplexCopy() that can
  10. be called */
  11. %rename(ComplexCopy) Complex::Complex(Complex const &);
  12. /* Now grab the original header file */
  13. %include "example.h"
  14. /* An output method that turns a complex into a short string */
  15. %extend Complex {
  16. char *__str__() {
  17. static char temp[512];
  18. sprintf(temp,"(%g,%g)", $self->re(), $self->im());
  19. return temp;
  20. }
  21. };