On 16/03/2017 at 10:29, xxxxxxxx wrote:
Hi,
the answer to many of your questions is "for historic reasons".
Not sure, you have already seen the GeData manual. Personally I never had a reason to make use of GeData directly, except in cases it needs to be passed to or is returned by one of our API functions.
For example we recommend to rather use Get-/SetParameter() (which both involve use of GeData) instead of accessing the BaseContainer of a node directly (as this enables the node's implementation to take part in the getting and setting of parameters and for example, update member variables in the process or even decide to not store data in the BaseContainer at all).
In general you are right, something similar could also have been achieved with C++ templates, but for reasons beyond my knowledge, the developers decided to go the GeData route. And I'm pretty sure, they had good reasons to do so. One advantage of the GeData approach is of course, that you can work with GeData without knowing anything about the contained data type. For example you can read a parameter and pass it on to another place (e.g. write it into a BaseContainer) without a single line of code caring for the contained data type.
For the arrays, this really is a grown topic and for the most part BaseArray is your best choice. It's more versatile and supports more modern C++ features than, lets say, AtomArray. And the best part, BaseArray is highly optimized. But again, the API is grown in many, many years and we can't change it easily without breaking existing plugins, so there will certainly be functions where you need either type of array.
For the AtomArray there's also a manual as it is still one of the more commonly used array types. But I'm pretty sure, we'll deliver one for BaseArray as well.
The BaseLinkArray is more or less a convenience version of BaseArray to store BaseLinks.
BlockArray is a "memory optimized" array. As the API docs state, it provides you with means to preallocate blocks (hence the name, from memory block) of certain size, thus reducing the need for new allocations, when inserting elements. The need for this highly depends on your algorithm. Usually if not sure about the needs, you'll use a BaseArray first and in a later optimization process you might switch to a BlockArray.
BaseListHead and BaseListNode are in a way the "successors" of GeListHead and GeListNode. But while with the "Ge" versions, the list node was part of the inheritance chain of a C4DAtom and thus these worked only with C4DAtom derived entities, the "Base" variants can now, as you correctly stated, build lists with arbitrary data types. With BaseListHead being somewhat the anchor of the list and BaseListNodes being, well, the nodes or elements in the list.
Cheers,
Andreas