[vtk-developers] Containers and... String
David Gobbi
dgobbi at irus.rri.ca
Mon Jan 21 15:48:18 EST 2002
Hi Andy,
I think this is a very good idea. Here are a few comments:
On Mon, 21 Jan 2002, Andy Cedilnik wrote:
> Hello!
>
> So, to continue the discussion about containers,
> I suggest the following simple hierarchy of containers:
>
> Abstract base class: vtkContainer
> - Defines things such as Number of elements, capacity,
> interface for clean and is empty
>
> Two abstract subtrees: vtkAssociativeArray and vtkList
> - List defines operations such as:
> Insert, append, prepend, push, pop, lookup,
> find, remove, shift, rotate, etc
> - Associative array defines:
> Set, Remove, Find
>
> List contains:
> - vtkVector, which is a dynamic array implementation of
> List data structure
Instead of making a vtkVector class, just expand the vtkCollection
class (which is already used all over the place). I would love,
for example, to be able to use the collection[] and *collection++.
> - vtkLinkedList, which is a linked list implementation
Unnecessary as far as I can see, it's probably best not to provide
a linked list.
> AssociativeArray contains:
> - vtkHashTable, which is a hash table implementation
An efficient hash table would be a very useful thing.
> - vtkTree, which is a (red-black) tree implementation
Again, possibly unnecessary.
> - vtkArrayTable, which is an array implementation
I'm not quite sure what this is.
> vtkContainer class is not subclass of vtkObject, so that we
> can use containers inside vtkObject class for things such
> as Observers.
I would much prefer that the containers are subclassed from
vtkObject, so that they can be reference counted etc. Also,
wrapping classes that are not derived from vtkObject is a pain.
Finally, I would like it if all the 'items' in the containers
are vtkObjects.
> Comments?
>
> On the side note, I also think we need a vtkSring class.
Again, I would like to see this derived from vtkObject. It should
specifically be a 'vtk string', not just a re-implementation of
the stl string (re-implementing stl strings would be a rather
pointless exercise IMHO).
- David
More information about the vtk-developers
mailing list