home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!corax.udac.uu.se!buzz.bmc.uu.se!perrier!sundvall
- From: sundvall@perrier.embnet.se (Mats Sundvall)
- Newsgroups: comp.lang.c++
- Subject: xdr layer above iostream's
- Date: 7 Jan 1993 11:56:46 GMT
- Organization: EMBNet Project Sweden
- Lines: 47
- Distribution: world
- Message-ID: <1ih5puINN4fj@buzz.bmc.uu.se>
- Reply-To: sundvall@perrier.embnet.se
- NNTP-Posting-Host: perrier.embnet.se
- Keywords: xdr c++ iostream
-
-
- We have a need to communicate between machines with different byte ordering.
- I though about using XDR, but as we are using C++ and iostreams of different
- kinds, even for tcp I am thinking about different ways of implementing an
- xdrstream.
-
- I have implemented an Xdr class with the help of the xdr_rec. I have
- a constructor Xdr(iostream*) and can then put a XDR layer above a stream.
- All the operator input and output methods are then implemented to read
- from and write to Xdr.
-
- Another way to implement it would be to implement a new iostream subclassing
- from ios and streambuf.
-
- I now wonder what pros and cons there is with these different approches, and
- if there are other ways to do it that I haven't thought about.
-
- If you implement it with a bunch of new streams you have to implement all the
- different streams again (iostreams, fstreams, tcpstreams, tlistreams) but with
- xdr. Maybe you can do some smart subclassing from these but I am not confident
- enogh about the internals of streams to know that.
-
- The advantage would be that they all inherit from iostreams and that all existing
- code that read and write to iostreams will work without having to implement
- Xdr::operator<<(MyClass&) and >> methods.
-
- I am also not sure if you can get all the status in ios up to the xdr class if
- you use the first method, the Xdr class. I thought about implementing the
- operator== and operator!= methods for Xdr to check the status but maybe that is
- not enough?
-
- And what about iomanips?
-
- If anyone have comments please tell me,
-
- Regards,
-
- Mats Sundvall
- Dept of Medical Genetics,
- Uppsala University
- Sweden
-
- sundvall@perrier.embnet.se
-
-
-
-
-