<div dir="ltr">Hi folks,<br><br>Firstly, I'm so happy that we've enabled C++11 in VTK :-)<br><div><br></div><div>I have a merge request for a new testing utility that you may find useful. While adding support for bit arrays to the XML writers, I needed to make sure that the new functionality worked no matter which combination of writer settings were used (byte order, data mode, compression, etc).<br><br>To make this easier, I added a class template that will do exactly that -- you specify options and possible values, and vtkPermuteOptions will simplify testing all possible combinations of these, e.g.<br><br><font face="monospace, monospace">// vtkPermuteOptions is templated on the class that gets configured:</font></div><div><font face="monospace, monospace">vtkPermuteOptions<<wbr>vtkXMLWriter> config;<br></font></div><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Add option ByteOrder with values BigEndian and LittleEndian</font></div><div><font face="monospace, monospace">// in separate AddOptionValue calls:</font></div><div><font face="monospace, monospace">this->AddOptionValue("<wbr>ByteOrder", &vtkXMLWriter::SetByteOrder,</font></div><div><font face="monospace, monospace">                     "BigEndian", vtkXMLWriter::BigEndian);</font></div><div><font face="monospace, monospace">this->AddOptionValue("<wbr>ByteOrder", &vtkXMLWriter::SetByteOrder,</font></div><div><font face="monospace, monospace">                     "LittleEndian", vtkXMLWriter::LittleEndian);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Add option CompressorType with values NONE, ZLIB, and LZ4</font></div><div><font face="monospace, monospace">// in a single AddOptionValues call:</font></div><div><font face="monospace, monospace">this->AddOptionValues("<wbr>CompressorType", &vtkXMLWriter::<wbr>SetCompressorType,</font></div><div><font face="monospace, monospace">                       "NONE", vtkXMLWriter::NONE,</font></div><div><font face="monospace, monospace">                       "ZLIB", vtkXMLWriter::ZLIB,</font></div><div><font face="monospace, monospace">                       "LZ4", vtkXMLWriter::LZ4);</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Generate the permutation list:<br></font><div><font face="monospace, monospace">config.InitPermutations();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Loop through all combinations of options</font></div><div><font face="monospace, monospace">while (!config.<wbr>IsDoneWithPermutations())</font></div><div><font face="monospace, monospace">{</font></div><div><span style="font-family:monospace,monospace">  // Apply the current option permutation to a vtkXMLWriter object:</span><br></div><div><font face="monospace, monospace">  vtkXMLWriter *writer = ...;</font></div><div><font face="monospace, monospace">  config.<wbr>ApplyCurrentPermutation(<wbr>writer);</font></div><div><font face="monospace, monospace">  </font></div><div><font face="monospace, monospace">  // Testing code:</font></div><div><font face="monospace, monospace">  std::cout << "Testing " << config.GetCurrentPermutationName() << "\n";</font></div><div><font face="monospace, monospace">  runTest(writer);</font></div><div><font face="monospace, monospace"><br></font></div><div><span style="font-family:monospace,monospace">  config.GoToNextPermutation();</span><br></div><div><font face="monospace, monospace">}</font></div></div><div><br></div><div>In this example, runTest will be called 6 times, while varying the specified options:</div><div><br></div><div><div><font face="monospace, monospace">Test Iteration    ByteOrder         CompressorType</font></div><div><font face="monospace, monospace">--------------    ---------         --------------</font></div><div><font face="monospace, monospace">1                 BigEndian         NONE</font></div><div><font face="monospace, monospace">2                 BigEndian         ZLIB</font></div><div><font face="monospace, monospace">3                 BigEndian         LZ4</font></div><div><font face="monospace, monospace">4                 LittleEndian      NONE</font></div><div><font face="monospace, monospace">5                 LittleEndian      ZLIB</font></div><div><font face="monospace, monospace">6                 LittleEndian      LZ4</font></div></div><div><br></div><div>I figured I'd mention this here, since I've found myself wanting this capability several times over the years and thought it may be of general interest. The merge request is up here:<br><br><a href="https://gitlab.kitware.com/vtk/vtk/merge_requests/3808">https://gitlab.kitware.com/vtk/vtk/merge_requests/3808</a><br><br>Also, I'm open to a name change if anyone wants to flex their knowledge of mathematics ;) I'm not 100% sure that "permutation" is the best name for this sort of operation.<br><br>Cheers,<br>Allie</div></div>