clone: Clone protocol buffer messages

clone-methodsR Documentation

Clone protocol buffer messages

Description

Generic "clone" function and associated method for Message objects

Methods

signature(object = "Message")

clone the message

Examples

## 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 )

## End(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 )

RProtoBuf documentation built on Nov. 3, 2022, 9:06 a.m.