>On a related note, can anyone tell me whether or not the
>"Buffer::allRelatives()" method is supposed to contain also
>the buffer on which it is called ? And, also, whether it
>includes "cousins" ?
>

Well, have a look at the Buffer::collectRelatives() function:

>void Buffer::collectRelatives(BufferSet & bufs) const
>{
>       bufs.insert(this);

Apparently, the buffer which it is called on is inserted..

>       if (parent())
>               parent()->collectRelatives(bufs);

.. and it recursively collects all relatives of the parent, so
collecting also cousins. (It looks like you will insert duplicates but
that's not a problem with a set).

>
>       // loop over children
>       Impl::BufferPositionMap::iterator it =
d->children_positions.begin();
>       Impl::BufferPositionMap::iterator end =
d->children_positions.end();
>       for (; it != end; ++it)
>               bufs.insert(const_cast<Buffer *>(it->first));
>}

>My only problem, in that part of code, was to get an "absolute"
>ordering of all related buffers, independently of which buffer
>I start from. AFAIU, from Vincent's comments, perhaps such thing
>may be obtained with something like:
>
>  p_buffer->masterBuffer()->allRelatives()
>

I'm not sure whether it will recurse down. Are all children and
grand_children included in d->children_positions, or only the direct
children ? You can try it of course and see what happens.

>(perhaps the master itself is missing from the collection). Am I wrong
?

Yes, the master is not missing from the collection (see the
bufs.insert(this)).

Vincent

Reply via email to