[saga-rg] open_flag and open_dir_flags

Andre Merzky andre at merzky.net
Mon Mar 6 14:29:04 CST 2006


Hi Graeme, 

Quoting [Graeme Pound] (Mar 01 2006):
> Hi,
> 
> The relationship between the enumerations open_flag and open_dir_flags 
> in the various packages of the API is a little problematic.
> 
> Graeme
> 
> 
>  -3.35 How should interfaces inheriting from ns_directory and ns_entry 
> inherit/override the enumerations open_flag and open_dir_flags? The 
> methods of ns_directory open_dir() and open() will require the 
> enumerations defined in the name_space package (or sub-classes of these 
> enumerations).

The reason for the various incarnations of open_flags are
that these have different meanings for the various classes.
We wanted to keep the ability to introdice a flag for
opening logical files (e.g. UseVersioning) which might not
needed or might have no meaning in namespace or for physical
files.  

If that at the end should be too troublesome, a global
open_flag enum in name_space would probably do the trick -
we would need to verbosely specify what flags are to be
ignored in logical files or physical files though.

However...


> With Java enumerations it would be possible to extend the original 
> enumerations by sub-classing, but it is not possible to not remove 
> fields. Unfortunately saga.logical_file.open_flags removes fields from 
> saga.name_space.open_flags.

... that should have been cleaned.  I had a pending commit,
is in CVS now, which fixes that.  The flags are now:


 +-------------------+-------------------+--------------------+
 | name_space        | physical_file     |  logical_file      |
 +-------------------+-------------------+--------------------+
 | Unknown    =  -1, | Unknown    =  -1, |  Unknown    =  -1, |
 | Create     =   1, | Create     =   1, |  Create     =   1, |
 | Excl       =   2, | Excl       =   2, |  Excl       =   2, |
 | Lock       =   4  | Lock       =   4, |  Lock       =   4, |
 |                   | Truncate   =   8, |  Truncate   =   8, |
 |                   | Append     =  16, |  Append     =  16, |
 |                   | Read       =  32, |  Read       =  32, |
 |                   | Write      =  64, |  Write      =  64, |
 |                   | ReadWrite  = 128  |  ReadWrite  = 128  |
 +-------------------+-------------------+--------------------+

Note that Truncate, Append, Read, Write and ReadWrite have
different semantics for the latter two.

Does that make sense to you?

Cheers, Andre.


-- 
"So much time, so little to do..."  -- Garfield





More information about the saga-rg mailing list