[vtk-developers] VTK containers are gone; long live VTK containers
John Biddiscombe
jbiddiscombe at skippingmouse.co.uk
Tue Jan 7 13:08:42 EST 2003
Is vtkObjectBase obsolete now?
JB
----- Original Message -----
From: "Andy Cedilnik" <andy.cedilnik at kitware.com>
To: "vtk-developers" <vtk-developers at public.kitware.com>
Sent: Tuesday, January 07, 2003 4:21 PM
Subject: [vtk-developers] VTK containers are gone; long live VTK containers
> Hello All,
>
> After long time of worrying and wondering about the possible solutions
> to container problems in VTK, we finally made a decision. VTK will start
> internally using STL containers. That means so called Andy's containers
> (vtkVector, vtkHashMap, vtkLinkedList...) are out. Brad modified all the
> VTK classes that used VTK containers to use STL containers and he did
> some magic so that they will compile on all platforms.
>
> Some gains:
>
> 1. Standard interface STL
> 2. Use of STL algorithms
> 3. Optimized and verified implementations
>
> Some potential loses:
>
> 1. Reference counting
>
> The VTK containers did some magic with overloaded functions which
> resulted in automatic reference counting for VTK objects. Unfortunately,
> that meant that VTK objects were always reference counted. The STL
> containers on the other hand do not do any reference counting. The
> workaround is to use smart pointer. The gain here is that you can chose
> between doing reference counting and not.
>
> Example of container that uses reference counting:
>
> vtkstd::vector< vtkSmartPointer< vtkActor > > v;
>
> 4. Need to use namespace hack
>
> The use of STL containers unfortunately involves the use of namespace on
> some platforms. Current VTK implementation of IO streams does this all
> useful IO streams things into global namespace. For containers, we
> decide to actually have a macro which points to the right namespace. So
> instead of:
>
> map<string, vector<int> > m;
>
> or
>
> std::map<std::string, std::vector<int> > m;
>
> you will always have to do:
>
> vtkstd::map<vtkstd::string, vtkstd::vector<int> > m;
>
> If you use map, you have to do:
>
> #include <map>
>
> and so on for other containers.
>
> That is all.
>
> Please send comments to the list.
>
> Thank you.
>
> Andy Cedilnik
> Kitware Inc.
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
More information about the vtk-developers
mailing list