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

generate a swap() method for all generated structs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.9
    • C++ - Library
    • None

    Description

      From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
      From: Adam Simpkins <simpkins@fb.com>
      Date: Mon, 21 Jun 2010 20:24:50 +0000
      Subject: [PATCH 3/5] generate a swap() method for all generated structs

      Summary:
      Andrei mentioned it would be convenient if thrift generated swap()
      methods for all C++ thrift types. Apparently the ads team manually
      writes swap() functions for many of their thrift data types, but have to
      keep updating them by hand when new fields are added to the thrift
      interface.

      This updates the thrift compiler to emit swap() methods for user-defined
      types. For now, I decided not to emit swap() methods for the internal
      XXX_args, XXX_pargs, XXX_result, and XXX_presult types.

      Test Plan:
      Tested compiling serveral internal projects.
      I didn't actually test the generated swap() functions, but they look
      okay.

      DiffCamp Revision: 124773
      Reviewed By: aalexandre
      Commenters: dreiss, edhall
      CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
      thrift-team@lists
      Revert Plan:
      OK

      git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a

      compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
      1 files changed, 67 insertions, 3 deletions

      Attachments

        Activity

          People

            davejwatson@fb Dave Watson
            davejwatson@fb Dave Watson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: