RProtoBuf (version 0.4.11)

clone-methods: Clone protocol buffer messages

Description

Generic "clone" function and associated method for '>Message objects

Arguments

Methods

signature(object = "Message")

clone the message

Examples

Run this code
# NOT RUN {
# example proto file supplied with this package
proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" )

# reading a proto file and creating the descriptor
Person <- P( "tutorial.Person", file = proto.file )
# }
# NOT RUN {
# creating a prototype message from the descriptor
sheep <- new( Person, email = "francoisromain@free.fr", id = 2 )

# cloning the sheep
newsheep <- clone( sheep )

# clone and update at once
newsheep <- clone( sheep, id = 3 )

# this can also be used as a pseudo method
sheep$clone()
sheep$clone( id = 3 )
# }

Run the code above in your browser using DataCamp Workspace