Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-676

Change C++ code generator so that generated classes can be wrapped with SWIG

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.3
    • 0.4
    • C++ - Compiler
    • None
    • Any C++

    • Patch Available

    Description

      There are times when it would be beneficial to wrap Thrift-generated C++ classes with the SWIG tool (http://www.swig.org). This is a problem, though, because SWIG does not yet handle nested class or structure definitions and the C++ code generator defines the __isset structure within the scope of the class definition to which it pertains.

      In order to make the Thrift-generated classes wrappable by SWIG, the __isset structure definition needs to be moved outside of the class definition. For a Thrift generated class called foo, the __isset definition would look like this:

      typedef struct foo_isset {
      foo_isset() : member0(false), member1(false) {}
      bool member0;
      bool member1;
      } foo_isset;

      and the using class would contain this line:
      foo_isset __isset;

      All existing code will continue to work, and can be regenerated at will.

      I have a patch for this.

      Attachments

        1. patchThrift-676.txt
          4 kB
          Rush Manbert

        Activity

          People

            rush Rush Manbert
            rush Rush Manbert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: