www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - mmfile cleanup

reply "Ben Hinkle" <bhinkle mathworks.com> writes:
Since Matthew seems to be busy, I'd like to send Walter an updated
std.mmfile. I'd like to remove the "auto" from the class declaration. Also
I'll change the old-style opIndex(i,val) to opIndexAssign(i,val). Are there
any other changes to mmfile that people would like to see?

I'll also uncomment the code in std.stream that wraps an MmFile with a
stream interface.

-Ben
Dec 02 2004
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
 Since Matthew seems to be busy,
Just found out it's one more week. (It's always _one more week_ ...)
 I'd like to send Walter an updated
 std.mmfile. I'd like to remove the "auto" from the class declaration.
Also
 I'll change the old-style opIndex(i,val) to opIndexAssign(i,val). Are
there
 any other changes to mmfile that people would like to see?
All of the above are fine by me.
 I'll also uncomment the code in std.stream that wraps an MmFile with a
 stream interface.
Don't have enough info to comment, but sounds sensible, as long as they're not unreasonable coupled to each other as a consequence
Dec 02 2004
parent reply Ben Hinkle <bhinkle4 juno.com> writes:
Matthew wrote:

 
 Since Matthew seems to be busy,
Just found out it's one more week. (It's always _one more week_ ...)
 I'd like to send Walter an updated
 std.mmfile. I'd like to remove the "auto" from the class declaration.
Also
 I'll change the old-style opIndex(i,val) to opIndexAssign(i,val). Are
there
 any other changes to mmfile that people would like to see?
All of the above are fine by me.
ok - thanks for MmFile, by the way. Looking at the code again I see I need to fix a bug in the stream interface if the MmFile isn't writeable. Currectnly MmFile doesn't store the mode so another change to MmFile would be to store the mode flag the user requested so that the stream class can figure out if the MmFile is writable. The mode flag would be a read-only property of type MmFile.Mode. Oh yeah, another change is to make the module name std.mmfile instead of just mmfile.
 I'll also uncomment the code in std.stream that wraps an MmFile with a
 stream interface.
Don't have enough info to comment, but sounds sensible, as long as they're not unreasonable coupled to each other as a consequence
There is a parametrized stream class that takes any type that acts like an array and wraps it in a stream. There already existed MemoryStream that wraps an honest-to-god array. The commented out code is to wrap MmFiles plus some unittests. -Ben
Dec 03 2004
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Just a thought, but I never liked the name MmFile. I hate contractions.

How would people feel about it being the uncontracted MemoryMappedFile?

"Ben Hinkle" <bhinkle4 juno.com> wrote in message
news:coposn$1357$1 digitaldaemon.com...
 Matthew wrote:

 Since Matthew seems to be busy,
Just found out it's one more week. (It's always _one more week_ ...)
 I'd like to send Walter an updated
 std.mmfile. I'd like to remove the "auto" from the class
declaration.
 Also
 I'll change the old-style opIndex(i,val) to opIndexAssign(i,val).
Are
 there
 any other changes to mmfile that people would like to see?
All of the above are fine by me.
ok - thanks for MmFile, by the way. Looking at the code again I see I
need
 to fix a bug in the stream interface if the MmFile isn't writeable.
 Currectnly MmFile doesn't store the mode so another change to MmFile
would
 be to store the mode flag the user requested so that the stream class
can
 figure out if the MmFile is writable. The mode flag would be a
read-only
 property of type MmFile.Mode.

 Oh yeah, another change is to make the module name std.mmfile instead
of
 just mmfile.

 I'll also uncomment the code in std.stream that wraps an MmFile
with a
 stream interface.
Don't have enough info to comment, but sounds sensible, as long as they're not unreasonable coupled to each other as a consequence
There is a parametrized stream class that takes any type that acts
like an
 array and wraps it in a stream. There already existed MemoryStream
that
 wraps an honest-to-god array. The commented out code is to wrap
MmFiles
 plus some unittests.

 -Ben
Dec 03 2004
prev sibling parent reply "Carlos Santander B." <csantander619 gmail.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> escribi� en el mensaje 
news:conaiv$fd6$1 digitaldaemon.com...
| Since Matthew seems to be busy, I'd like to send Walter an updated
| std.mmfile. I'd like to remove the "auto" from the class declaration. Also
| I'll change the old-style opIndex(i,val) to opIndexAssign(i,val). Are there
| any other changes to mmfile that people would like to see?
|
| I'll also uncomment the code in std.stream that wraps an MmFile with a
| stream interface.
|
| -Ben
|
|

What I would really like would be seeing only one of OutBuffer, MemoryStream
and 
MmFile. Which one, I don't know. Surely derived from std.stream.Stream, but
that 
doesn't mean it has to be MemoryStream.

-----------------------
Carlos Santander Bernal 
Dec 03 2004
parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"Carlos Santander B." <csantander619 gmail.com> wrote in message
news:coqkgg$2ddd$2 digitaldaemon.com...
 "Ben Hinkle" <bhinkle mathworks.com> escribi� en el mensaje
 news:conaiv$fd6$1 digitaldaemon.com...
 | Since Matthew seems to be busy, I'd like to send Walter an updated
 | std.mmfile. I'd like to remove the "auto" from the class declaration.
Also
 | I'll change the old-style opIndex(i,val) to opIndexAssign(i,val). Are
there
 | any other changes to mmfile that people would like to see?
 |
 | I'll also uncomment the code in std.stream that wraps an MmFile with a
 | stream interface.
 |
 | -Ben
 |
 |

 What I would really like would be seeing only one of OutBuffer,
MemoryStream and
 MmFile. Which one, I don't know. Surely derived from std.stream.Stream,
but that
 doesn't mean it has to be MemoryStream.

 -----------------------
 Carlos Santander Bernal
MmFile is different enough from OB and MS that it can't be replaced with one of those but I can see your point that OB and MS are very similar and could be combined somehow. Scanning over the two it looks like the differences are: 1) OB is probably faster than MS 2) OB has alignment functions and spread 3) MS has read and seek support (OB mentions InBuffer in the help but I can't find any InBuffer) 4) MS subclasses Stream and so can be used in a generic Stream context. Hmm... Adding alignment and other stuff to MS would probably be pretty easy. The performance would be slightly worse, though. I have a feeling Walter wouldn't like seeing OB go away, but who knows. There is the question of backwards compatibility - though the outbuffer.d could consist of "alias MemoryStream OutBuffer".
Dec 03 2004