Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-1349

Change marshaling code to use json

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: Middleware
    • Labels:
      None

      Description

      The marshaling code for non-standard (i.e., non-filterable) components of messages is custom and not standard. Change this to use JSON.

        Attachments

          Issue Links

            Activity

            Hide
            spietrowicz Steve Pietrowicz added a comment -

            Russell, would you be able to do a code review for me? It's two functions in one file in ctrl_events, in src/Event.cc

            ctrl_events/tickets/DM-1349

            https://dev.lsstcorp.org/cgit/LSST/DMS/ctrl_events.git/commit/?h=tickets/DM-1349&id=41bb9fa3178119dc94dff75c282c37b9b8869090

            Show
            spietrowicz Steve Pietrowicz added a comment - Russell, would you be able to do a code review for me? It's two functions in one file in ctrl_events, in src/Event.cc ctrl_events/tickets/ DM-1349 https://dev.lsstcorp.org/cgit/LSST/DMS/ctrl_events.git/commit/?h=tickets/DM-1349&id=41bb9fa3178119dc94dff75c282c37b9b8869090
            Hide
            rowen Russell Owen added a comment -

            This looks acceptable, but I suggest trying to figure out if there's a cleaner way to do this than long if/else statements with so much repetitive boilerplate. Admittedly that code already existed, but the use of boost has added even more lines of boilerplate to Event::marshall.

            One thought: construct a templated class that can marshal and unmarshal one data type. Then use a pair of maps (or unordered_map, now that we support C++11) to hold instances of these classes: one map that is used by marshall uses typeid(type) as keys. The other map is used by unmarshall and so has keys that are type names (strings).

            Show
            rowen Russell Owen added a comment - This looks acceptable, but I suggest trying to figure out if there's a cleaner way to do this than long if/else statements with so much repetitive boilerplate. Admittedly that code already existed, but the use of boost has added even more lines of boilerplate to Event::marshall. One thought: construct a templated class that can marshal and unmarshal one data type. Then use a pair of maps (or unordered_map, now that we support C++11) to hold instances of these classes: one map that is used by marshall uses typeid(type) as keys. The other map is used by unmarshall and so has keys that are type names (strings).
            Hide
            spietrowicz Steve Pietrowicz added a comment -

            Thanks for the review.

            I ended up moving that common code to a templated method within Event.c. I also removed some now obsolete methods which are no longer in use. This reduced the common code and the size of the overall module.

            Show
            spietrowicz Steve Pietrowicz added a comment - Thanks for the review. I ended up moving that common code to a templated method within Event.c. I also removed some now obsolete methods which are no longer in use. This reduced the common code and the size of the overall module.

              People

              • Assignee:
                spietrowicz Steve Pietrowicz
                Reporter:
                spietrowicz Steve Pietrowicz
                Reviewers:
                Russell Owen
                Watchers:
                Russell Owen, Steve Pietrowicz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel