[omniORB] Need to save Any to void* - serialise it?

David Riddoch djr@uk.research.att.com
Tue, 20 Apr 1999 16:45:34 +0100 (GMT)


Hi,


The following should work (modulo error checking):

void omniORB_save_any(const CORBA::Any& a, int fd)
{
  MemBufferedStream s;

  a >>= s;
  s.rewind_in_mkr();
  write(fd, a.data(), a.alreadyWritten());
}

This is of course an internal API, and will change in a future release of
omniORB - but even then something similar will be possible.


David



On Tue, 20 Apr 1999, Michal Grzemowski wrote:

> Hello, 
> 
> While working on a distributed system being a major part of my master
> thesis I have come upon a problem, which was impossible for me to get
> through.
> 
> I need to save an Any object to disk (I need it to create a log of
> operations) . To do that I need to convert an Any to a sequence of bytes
> (void * ???). 
> 
> I have read the declaration of the Any class. There are member functions
> like:
> 
>     // omniORB2 data-only marshalling functions
>     void NP_marshalDataOnly(NetBufferedStream& s) const;
>     void NP_unmarshalDataOnly(NetBufferedStream& s);
> 
>     void NP_marshalDataOnly(MemBufferedStream& s) const;
>     void NP_unmarshalDataOnly(MemBufferedStream& s);
> 
>     size_t NP_alignedDataOnlySize(size_t initialoffset) const;
> 
>     // omniORB2 internal stub support routines
>     void PR_packFrom(TypeCode_ptr newtc, void* tcdesc);
>     Boolean PR_unpackTo(TypeCode_ptr tc, void* tcdesc) const;
> 
> which (looking at their names) might do that, but I don't know what they
> do and how they work. 
> 
> Can anyone provide me with a description of those functions? If so, I
> would probably need a description of Mem(Net)BufferedStream, which, as
> far as I know is also an internal OmniOrb class.
> 
> If it wouldn't work, maybe there would be a possibility of using the
> parser which comes with the Any class?
> 
> Please help, this system isn't going to operate without that.
> 
> Looking forward to hearing from you soon,
> 
> Michal Grzemowski
> 
> P.S. To the creators of OmniOrb:
> 
> You are doing a GREAT JOB! Your software is the most bug-free ORB
> implementation I came in touch so far. I have been working with Orbix
> (featuring everything but the holy spirit itself ;), but it had one
> major problem - DIDN'T WORK. And sending bug reports to Iona feels like
> talking to a wall. In comparison to them your software is GREAT!!! If it
> doesnt support something, you honestly say that and all the features I
> have been working with did work - KEEP ON!!!
> 
>