Re: archive methods?

Denis Corbin <[email protected]> Sat, 17 Jul 2004 16:22:50 +0200
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johnathan Burchill wrote:
| Hi Denis,

Hello Johnathan,

|
| Now that libdar uses the "archive" class, what is the possibility of
having
| the various libdar operations implemented as methods of the archive class?
|
| Instead of
|
| libdar::archive *theArchive;
|
| libdar::open( theArchive, ...)
| libdar::test( theArchive, ...)
| etc.
|
| what about having
|
| libdar::archive *theArchive( path, basename, etc.)
|
| theArchive->open();
| theArchive->test();
|
| Have you considered this?

yes, I did. I even intially wanted to implement things this way.

| I'm not sure what this would accomplish, besides
| quite a bit of possibly unnecessary code rewriting.

I don't think there is too much code rewriting for that be possible.

| It just ocurred to me
| that an archive is the main object for libdar, and the usual way in
c++ is
| to implement functions as methods.

yes, I agree.

|
| Please enlighten me if I am off base here. I'm not sure that I've thought
| this through very much. Sorry in advance if this has been documented
| elsewhere.

In fact, if I did not do this way, is to keep API a set of normal
functions, for those who could call libdar from a program written in C,
Pascal, or any other language. Of course some of the arguments are
objects. But, for a non C++ programmer it is maybe more intuitive to use
a pure C function than a method on an object.

This is the reason why I did not moved op_create and other methods as
members of archive class.

Another problem is the _noexcept variants of API calls. In particular
the open_archive_noexcept() call which would correspond to a constructor
for the archive class. constructor do not return error, so if it is not
possible to throw exception to report an error, how would it be possible
to report an error during the archive object construction ? OK, one
could make a fake constructor, that do nothing real, and a
open_archive_noexcept() method that (as it is now a normal method), can
return an error code status, but, I don't see much more interest
compared to normal functions.

any objections ? comments ? ;-)

|
| Cheers,
| JB
|

Cheers,
Denis.

P.S.:
Johnathan, I cannot figure out how to find your public key. It is not on
your web site (there is old obsolete one only), nor it is on any key
servers I tried.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFA+TY6pC5CI8gYGlIRAiwaAJ9y6KrSZRM1YOEtjzE+WKz8hqXQkQCeI4GW
lZj52GTaJKQ3gXrF7xT9uBI=
=I0Tl
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click