Spanning Trees: Overload instead of weird ownership logic
authorPhil Miller <mille121@illinois.edu>
Fri, 5 Mar 2010 00:37:42 +0000 (18:37 -0600)
committerPhil Miller <mille121@illinois.edu>
Fri, 5 Mar 2010 01:23:50 +0000 (19:23 -0600)
commitc70536e3f2ad92259273be03bf8eb013d808d6cc
tree970e4e69fcd8db9b0b96a9c1726d57e9a4c29f04
parent0ef0706e65ce944933f460aaa605d4846f61a04f
Spanning Trees: Overload instead of weird ownership logic

Spanning trees generated for multicasts, reductions, and so forth can
be generated with either a user-supplied strategy or a default one
(selected by a factory knowledgeable of machien characteristics and so
forth). The logic to do this was based on checking if the argument to
buildSpanningTree[Generation] was NULL, and constructing a strategy if
it was. This strategy then had to be deleted afterward only if it was
locally constructed, a somewhat clunky arrangement.

Instead, split the "use the default strategy" logic into an overloaded
function that doesn't take the pointer argument, and passes through to
the (now-simplified) original version. Incidentally, some conditionals
are replaced by compile-time overload resolution.
src/util/spanningTreeStrategy.h