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

Andy Bauer andy.bauer at kitware.com
Tue Apr 3 10:41:02 EDT 2012


Since it's all static methods and no classes will derive from it, I was
thinking something along the lines of:
static void DeserializeMetaData(
  vtkMultiProcessStream& bytestream,
  std::vector<std::string> &names, std::vector<int> &datatypes,
  std::vector<int> &dimensions);

Using a vtkStringArray and vtkIntArrays though would work out just as well
though.

Both of them are much better than allocating memory in the function and
expecting the user to delete them afterwards.

Andy

On Mon, Apr 2, 2012 at 9:54 PM, George Zagaris
<george.zagaris at kitware.com>wrote:

> On Mon, Apr 2, 2012 at 9:34 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> > 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?
>
> Efficiency is not a huge concern for this method since field data
> metadata is relatively small. I would prefer a lighter API, but, I am
> not against changing the method to use vtkStringArray and vtkIntArray.
>
> Thanks for your feedback.
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120403/0c98d7ab/attachment.html>


More information about the vtk-developers mailing list