[saga-rg] C++ binding: question

Andre Merzky andre at merzky.net
Fri Nov 4 14:12:38 CST 2005


Hi all, 

here is another question about the C++ language binding we
stukmbled upon.  The API spec says that the session is an
optional argument to each object creation in SAGA.  If the
session is not given, a default session (theSession) is to
be associated with the object.

Now, consider a object which has a number of optyional
parameters already (example not spec conform):

  saga::file (string url, mode=saga::file::mode::RO, saga::session s);

If a programmer wants to specify a session, he NEEDS to
specify mode, and all other optional parameters of the
constructor.  For a programmer who always specifies a
session that is awkward.

OTOH, a constructor like

  saga::file (saga::session s, string url, mode=saga::file::mode::RO);
  
would giove that programmer the ability to use session and
rely on parameters defaults, but for another programmer who
does not use an explicit session it would require to ALWAYS
specify the session anyway:

  saga::file f (theSession, url);


The solution we would like to propose is to introduce two
versions of all constructors:

  saga::file (                 string url, mode=saga::file::mode::RO);
  saga::file (saga::session s, string url, mode=saga::file::mode::RO);

which would accomodate both use cases nicely.  To be sure:
that affects only the C++ language bindings - that might
look totally different for other languages.

Any comments?  If not, we go for the proposed solution...

Cheers, Andre.


-- 
+-----------------------------------------------------------------+
| Andre Merzky                      | phon: +31 - 20 - 598 - 7759 |
| Vrije Universiteit Amsterdam (VU) | fax : +31 - 20 - 598 - 7653 |
| Dept. of Computer Science         | mail: merzky at cs.vu.nl       |
| De Boelelaan 1083a                | www:  http://www.merzky.net |
| 1081 HV Amsterdam, Netherlands    |                             |
+-----------------------------------------------------------------+





More information about the saga-rg mailing list