From edd at debian.org  Tue Jun 25 18:36:44 2013
From: edd at debian.org (Dirk Eddelbuettel)
Date: Tue, 25 Jun 2013 11:36:44 -0500
Subject: [Rd] [R] How can C++ read the R object written into socket with
 saveRDS or save
In-Reply-To: <51C9C178.6000903@stats.ox.ac.uk>
References: <OF396F33FA.8A573204-ON48257B95.0055E30F-48257B95.00573B1B@cn.ibm.com>
	<51C9C178.6000903@stats.ox.ac.uk>
Message-ID: <20937.50972.767268.501415@max.nulle.part>


On 25 June 2013 at 17:12, Prof Brian Ripley wrote:
| On 25/06/2013 16:52, Rong lI Li wrote:
| > I found actually, the saveRDS writes the R object with XDR format. I could
| 
| It may do ... depending how you call it.  You may prefer to serialize() 
| to a raw vector whose size you can find, and transmit that.

I am not aware of a (simple) library parsing this outside of an R context
(and within the R context, I'd always start with Rserve from RForge.net).

But you could look into general serialization / translation libraries such as
Google Protocol Buffers (see https://developers.google.com/protocol-buffers/)
which can also translate into C++, Java, Python plus a host of
user-contributed bindings. 

For R, you will find a package RProtoBuf on CRAN.  There are other, related
libraries but I have worked only with Protocol Buffers.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



[Rd] [R] How can C++ read the R object written into socket with saveRDS or save
Dirk Eddelbuettel