[vtk-developers] Using STL containers as part of the API of a utility class

George Zagaris george.zagaris at kitware.com
Mon Apr 2 21:09:33 EDT 2012


Hello,

I have developed a utility class that provides functionality for
serializing/deserializing instances of vtkFieldData, primarily
intended for the purpose of sending data over MPI (and/or other
inter-process communication mechanism). The topic is submitted on
gerrit and is currently under review at the following URL:
http://review.source.kitware.com/#/t/268/

We are considering using STL containers as the parameters for the
method DeserializeMetaData, see  comments in
http://review.source.kitware.com/#/c/4851/1/Parallel/vtkFieldDataSerializer.h.

This method allocates arrays internally and implicitly propagates the
responsibility for de-allocating those to the caller. Using STL
vectors in this case would be a much safer approach to ensure that the
user will not introduce leaks. Although this would conflict with VTK
style guidelines, we do not anticipate that this class will be used
directly by our Python/TCL wrappers or any classes to inherit from it.
We were wondering if in this case it is reasonable to make an
exception and use STL containers. We wanted to extend this
conversation to the VTK mailing list to get more feedback. Thoughts?

Best,
George



More information about the vtk-developers mailing list