[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: More smart wrapping for struct types?
From:       Nicolas Brodu <nicolas.brodu () free ! fr>
Date:       2000-05-29 12:12:14
[Download RAW message or body]

Hi! Demuxing all this:

1. Structures must be copied, as they can be used as values.
2. This poses a performance probem for big structures.
3. Sequence of structs still has problems

For 1, this is done now. But maybe reference counting could be still used, if
combined with a copy-on-write feature.

For 2, we can do nothing about it as it is without passing a wrapper /
reference. At least, I don't have any idea how. But programmers just know what
copying structures imply anyway.

For 3, defining the iterator inside is fine. But why not completely dropping the
STL then?
idl:     sequence<User> listAllUsers();
c++:     std::vector<User> *listAllUsers();
As you point out, there is the memory leak problem (has to do delete).

Maybe we can have our own Arts::Sequence class, that would contain a
setAutoDelete/ref count feature like in Qt (and talking about an internal
iterator goes in that way too).
idl:     sequence<User> listAllUsers();
c++:     Arts::Sequence<User> listAllUsers();

That way, if you return a Sequence<User> you don't have the copy overload thanks
to reference counting. The setAutoDelete can also be set to true by the called
function. But we still need to have copy-on-write for the reason mentionned
above (in that case, that is copy a Struct User item is one of the referenced
Sequence modifies it). This also imply that we have reference counting for all
User item inside the sequence.

I just had the idea, didn't check if it's feasible or even acceptable when
passing small structures, and won't be able to work on it the next few days.

Yet, it might work...

Cheers,
Nicolas
-- 
A shortcut is the longest distance between two points. (unknown author)
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic