ImageEngine/gaffer — pull request #1059 by johnhaddon (2014-10-23 12:14:03+00:00)
Title: Plug improvements

This pull request implements the promotion of CompoundDataPlugs on Boxes, as requested in #1043. In doing this it became necessary to refactor the Plug, ValuePlug and CompoundPlug classes a fair bit, but for the better.

Previously, `Plug::acceptsChild()` refused all children, and then `CompoundPlug::acceptsChild()` overrode that to accept children. This disregarded the basic rule that derived classes may add further requirements, but may not be more liberal than their base classes (because, after all, the base class will have to support those children too). CompoundPlug also derived from ValuePlug, which meant that it wasn't possible to have child plugs without being forced to use a ValuePlug. Furthermore, because CompoundPlug could only be informed of input changes and child addition/removal via signals, it lacked the priviledges necessary to implement #1043.

This pull request fixes all these problems by allowing Plug and ValuePlug to have children directly, and updating Plug to correctly propagate the addition and removal of children from a source plug to a destination plug. This propagation allows CompoundDataPlugs to function as expected when promoted to a Box.

CompoundPlug remains purely for short-term compatibility - over time we'll phase it out entirely, replacing its use with either Plug or ValuePlug as applicable.