[Rprotobuf-yada] enabled lookup mechanism

Romain François francoisromain at free.fr
Mon Nov 2 09:49:40 CET 2009


Hi,

I've enabled the lookup mechanism :

 > require( RProtoBuf )
Loading required package: RProtoBuf
Loading required package: Rcpp
 > search()
  [1] ".GlobalEnv"               "package:RProtoBuf"
  [3] "package:Rcpp"             "package:stats"
  [5] "package:graphics"         "package:grDevices"
  [7] "package:utils"            "package:datasets"
  [9] "package:methods"          "Autoloads"
[11] "RProtoBuf:DescriptorPool" "package:base"
 > p <- new( tutorial.Person )
 > p
[1] "protobuf message of type 'tutorial.Person' "
 > new( tutorial.Person.PhoneNumber )
[1] "protobuf message of type 'tutorial.Person.PhoneNumber' "

At the moment, as you can see it uses the full path of the message type. 
This might be good enough, but it might also be interesting to maintain 
a set of prefixes, for example:

setPrefix( "tutorial" )
new( Person )
new( Person.PhoneNumber )

For this we would need to attach a c++ object in the privateData slot of 
the object table, so instead of this (in lookup.cpp) :

   tb->privateData = (void*)0 ;

we would have something like this :

   tb->privateData = (void*)setofprefixes ;

where setofprefixes is something that holds the prefixes.

If you play with this, you probably want to uncomment this line in 
rprotobuf.h :

// #define LOOKUP_DEBUG

Romain


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos



More information about the Rprotobuf-yada mailing list