Re: I/O class: how to design for special case
- From: jladd@xxxxxxxxxxxxxx
- Date: 24 Jan 2006 11:49:15 -0800
Simon,
Firstly, your description of the problem and suggested solutions is
nice. Thankyou for taking the time to explain the problem well and
come up with some possible solutions. Typically I see one liners with
very little to go on.
Secondly, Can CFoo provide a factory method that provides a CFooBuffer
with the CFoo methods able to accept this buffer.
Eg: CFooBuffer CFoo::newBufferWithDefaultSize()
This way your asking the object with the information to do the work for
you.
To avoid the buffer copy you could also have the CFoo::out methods take
a CFooBuffer but then as the CFooBuffer to write its
contents to where you need it to go. Here is an example if the output
was to go onto a socket ....
bool CFoo::out(cfooBufferInstance) { cfooBufferInstance.storeOn(socket)
}
ie: we still asking the object with the information to do the work. It
inverts control and is the OO approach IMHO.
I hope this helps,
Keep well
Rgs, James.
(http://www.jamesladdcode.com)
.
- Follow-Ups:
- Re: I/O class: how to design for special case
- From: Simon Elliott
- Re: I/O class: how to design for special case
- References:
- I/O class: how to design for special case
- From: Simon Elliott
- Re: I/O class: how to design for special case
- From: H. S. Lahman
- Re: I/O class: how to design for special case
- From: Simon Elliott
- Re: I/O class: how to design for special case
- From: H. S. Lahman
- I/O class: how to design for special case
- Prev by Date: Re: SQL
- Next by Date: Re: SQL
- Previous by thread: Re: I/O class: how to design for special case
- Next by thread: Re: I/O class: how to design for special case
- Index(es):
Relevant Pages
|