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

David Gobbi david.gobbi at gmail.com
Mon Apr 2 21:34:19 EDT 2012


Almost anything is better than "std::string* &names".  The odds are
slim to none that an arg like that will ever be wrapped ;)

Any reason for not using vtkStringArray and vtkIntArray?  Are you
concerned about their efficiency?

 - David


On Mon, Apr 2, 2012 at 7:09 PM, George Zagaris
<george.zagaris at kitware.com> wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list