PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/test-suite/template_enum_typedef.i

#
Swig | 39 lines | 28 code | 11 blank | 0 comment | 0 complexity | 546897901ec72250e5baa233c96edf77 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module template_enum_typedef
  2. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) oss::etraits; /* Ruby, wrong class name */
  3. %inline %{
  4. namespace oss
  5. {
  6. enum Polarization { UnaryPolarization, BinaryPolarization };
  7. template <Polarization P>
  8. struct Interface
  9. {
  10. };
  11. struct etraits
  12. {
  13. static const Polarization pmode = UnaryPolarization;
  14. };
  15. template <class Traits>
  16. struct Module
  17. {
  18. typedef Traits traits;
  19. static const Polarization P = traits::pmode;
  20. void get(Interface<P> arg) { }; // Here P is only replace by traits::pmode
  21. };
  22. }
  23. %}
  24. namespace oss
  25. {
  26. %template(Interface_UP) Interface<UnaryPolarization>;
  27. %template(Module_UP) Module<etraits>;
  28. }