[Rprotobuf-yada] make prototypes of message , field extraction
Romain François
francoisromain at free.fr
Fri Oct 30 20:30:48 CET 2009
Hi,
Did the first part of this now. so we can now extract non repeated
fields from a message (primitives and messages). Some precision might
get lost in the way because R does not have long, etc ... but I don't
think there is anything that can be done about that (apart from
implementing them in R).
I've also added basic completion, so that :
> Person<- P( "tutorial.Person", file = "/tmp/person.proto" )
> p<- new( Person )
> p$<TAB>
p$email p$id p$name p$phone
> Person$
Person$email Person$name Person$PhoneNumber
Person$id Person$phone Person$PhoneType
Now need to start thinking about repeated fields (arrays basically), and
setters, so that we can do :
> p$email <- "blabla at yada.com"
more type checking is needed for those.
I have a presentation in london next week, so I might not carry on much
further, but I'll pick up emails if you guys have questions.
Romain
On 10/30/2009 11:17 AM, Romain François wrote:
>
> Hello,
>
> We might now use the new method to create prototypes of messages as
> described by a given descriptor :
>
> Person<- P( "tutorial.Person", file = "/tmp/person.proto" )
> p<- new( Person )
>
>
> I have added some code to prepare field extraction (but no code yet). It
> is in extractors.cpp
>
> SEXP extractFieldAsSEXP( const Message * message, const Descriptor*
> desc, const FieldDescriptor * fieldDesc ){
>
> /* depending on the type, we need to create some regular SEXP (INTSXP)
> or a message */
>
> FieldDescriptor::Type type = fieldDesc->type() ;
>
> return R_NilValue;
>
> }
>
>
> The idea basically is to have a switch on the type and make the
> appropriate SEXP (INTSXP, STRSXP) for primitives or new instances of
> protobufMessage for messages.
>
> I'll have a look tonight if noone beats me to it (I need to get out now)
>
> Romain
>
> Ps: I have removed the #define foo Rf_foo
>
--
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