Re: [protobuf] Possible Protbuf cmake problem, or cmake bug

2016-05-16 Thread Robert Bielik
Hi Feng,

Den måndag 16 maj 2016 kl. 22:32:06 UTC+2 skrev Feng Xiao:
>
>
>
> Could you create a github issue for this? We are happy to accept a pull 
> request if you have found a workaround for this problem.
>

The only workaround so far though, is to omit the "include(install.cmake)" 
line. But I'll setup an issue for it.

Regards
/Robert

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] Re: [protobuf] How can I make python sync calls and streaming responses faster?

2016-05-16 Thread Yan Yan
ty

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Recommended C# library and compiler for ProtoBuf 2.6.1 and build instructions for VS2015

2016-05-16 Thread 'Feng Xiao' via Protocol Buffers
On Thu, May 12, 2016 at 3:55 PM, Kiran Desai  wrote:

> We are evaluating Protobuf 2.6.1 for cross-language messaging. Primary
> languages are going to be C++, Java and C#.
>
>
>1. Is there a release date planned for ProtoBuf 3.0?
>
> We hope to release 3.0 soon but there isn't a finalized date yet.


>
>1. Is the protobuf-csharp-port way to go for C# code (proto2)? If so,
>will it work with VS2015?
>
> protobuf-csharp-port is no longer maintained. Please use the C# version
coming with protobuf 3.0. The current beta version for C++, Java and C# is
already quite stable.


>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Generated library language versions

2016-05-16 Thread 'Feng Xiao' via Protocol Buffers
On Tue, May 10, 2016 at 5:20 PM, Trent Billington 
wrote:

> Where can I find information about which version of a target language is
> generated by the protobuf compilers? I can't find anything in the tutorials
> or reference information on the developers.google.com website.
>
> I would like to know with protobuf3, which version of python, and php is
> generated by the official compilers. Php is not released yet but should be
> "soon" (https://github.com/google/protobuf/issues/358). Why is this
> important information left out of the protobuf website, or in a easier to
> find place if it is there?
>
You can find the version information in the release page:
https://github.com/google/protobuf/releases

For example, if you are using protoc-3.0.0-beta-3, the python version will
be 3.0.0-beta-3, and Javascript version is 3.0.0-alpha-6.

We actually share the same version number across all languages, so the
language version of generated code is always the same as the version number
of protoc (note that 3.0.0-beta-3 is the same as 3.0.0-alpha-6).


> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Any vs. oneof in message wrappers

2016-05-16 Thread 'Feng Xiao' via Protocol Buffers
On Mon, May 16, 2016 at 11:30 AM, 'David Koch' via Protocol Buffers <
protobuf@googlegroups.com> wrote:

> Our platform generates/processes different types of proto3 messages with
> Kafka as buffer. We currently store this type as part of the Kafka message
> key so message consumers know which class to use for de-serialization.
>
> I want to add the type to the serialized message in order to not rely on
> the existence of a separate key. I thought about creating a wrapper message
> like this:
>
> message Header {
>   enum PayloadType {
> TYPE_ONE = 1;
> TYPE_TWO = 2;
>   }
>
>   int64 tmst = 1;
>   string message_id = 2;
>   string producer_id = 3;
>   PayloadType payload_type = 4;
> }
>
>
> // Any payload.
> message MessageWrapper {
>   Header header = 1;
>   Any payload = 2;
> }
>
>
> or alternatively:
>
> // List different payload options.
> message MessageWrapper {
>   Header header = 1;
>   oneof payload {
> PayloadTypeOne payload_type_one = 2;
> PayloadTypeTwo payload_type_two = 3;
>   }
> }
>
>
> My question: Is one of the two alternatives to be preferred?
>
I don't think you need the header in either case. If you are using an Any
message as payload, the payload already has the message type encoded in the
type URL. If you are using an oneof, the receiver can also query which
payload is set by using the oneof case API.

Comparing the two (using Any and using oneof), using Any would give your
users more flexibility to use their own message types, while using oneof
will require all users to define their message types in a single place (all
imported by the MessageWrapper type). The API for oneof is straightforward
then Any though. If you need the flexibility to allow different components
to define different payload types, Any is probably better. Otherwise I
would favor the simpler oenof API.


>
> Using Any leads to more complex setting/getting in the application code
> but it is more generic from the message definition point of view. Dropping
> the Header.PayloadType field in the definition using Any would allow me
> to not modify the MessageWrapper definition at all when adding new
> payload types.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Possible Protbuf cmake problem, or cmake bug

2016-05-16 Thread 'Feng Xiao' via Protocol Buffers
On Sun, May 15, 2016 at 12:46 AM, Robert Bielik 
wrote:

> Hi all,
>
> I'm using protobuf in our CMake based projects, and I've encountered a
> problem with TARGET_INCLUDE_DIRECTORIES not working as expected. Nominally
> if my target APP depens on libprotobuf, the PUBLIC part
> of TARGET_INCLUDE_DIRECTORIES should propagate to target APP.
>
> This does not work however, and the reason being is the install.cmake file
> in protobuf/cmake. The first section in install.cmake:
>
> foreach(_library
>   libprotobuf-lite
>   libprotobuf
>   libprotoc)
>   set_property(TARGET ${_library}
> PROPERTY INTERFACE_INCLUDE_DIRECTORIES
> $)
>   install(TARGETS ${_library} EXPORT protobuf-targets
> RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
> LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
> ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
> endforeach()
>
> messes up the TARGET_INCLUDE_DIRECTORIES declarations.
>
> If I comment out include(install.cmake) (row 153 in CMakeLists.txt),
> everything works as expected and the include directory declarations are
> propagated correctly to the dependant targets.
>
> Now, I don't know if this is a Protobuf CMake problem, or a bug in CMake
> itself. I'm leaning towards the latter.
>
Could you create a github issue for this? We are happy to accept a pull
request if you have found a workaround for this problem.


>
> Regards
> /Robert
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] How to erase particular field with MergeFrom()

2016-05-16 Thread 'Feng Xiao' via Protocol Buffers
On Wed, May 11, 2016 at 5:09 AM, Denis Bakhvalov 
wrote:

> Hi,
>
> Suppose I have such message structure:
>
>
> package msg_RepAndOpt;
>
> message RepAndOpt{
> repeated string name = 1;
> optional string surname = 2;
> ...
> // there are lots of others.}
>
>
> And I have two components that have copies of this message:
>
>
> // component1:RepAndOpt A;
> A.add_name("Name");
> A.set_surname("Surname");
> // component2:RepAndOpt B;
>
>
> In my case components modify those messages via transaction mechanism. It
> means that if one component changes some field it also sends it to another
> component to propagate those changes. Component-receiver is doing merge:
>
>
> // Component2 modifies B and sends it to component1.// Component1 perfoms 
> merge:
> A.MergeFrom(B);
>
>
> Now, say, component2 wants to erase field "name". If it will send clear B
> message (default construction) than:
>
>- - MergeFrom() will not modify A;
>- - CopyFrom() will erase also other fields.
>
> Another way will be to fill B with the contents of A, clear name field and
> component1 will use CopyFrom(). But this is not acceptable because system
> is really high-loaded and there could be lots of other fields. So, desired
> solution to clean name field is:
>
>1. 1. Component2 create B message.
>2. 2. Explicitly stores information that it want to erase only name
>field.
>3. 3. Component1 perform A.MergeFrom(B).
>4. 4. Result: A::name is cleared but other fields are left untouched.
>
> As far as I tested this applies to repeated and optional fields. Is there
> any ready-to-use solution or I should modify protobuf implementation?
>
I think you can do this using FieldMaskUtil:
https://github.com/google/protobuf/blob/beta-3/src/google/protobuf/util/field_mask_util.h#L111

You create an empty B message along with a FieldMask containing only the
field you want to clear, and use FieldMaskUtil::MergeMessageTo(A,
field_mask, )  to replace the field in A with the value from B.



> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Any vs. oneof in message wrappers

2016-05-16 Thread 'David Koch' via Protocol Buffers
Our platform generates/processes different types of proto3 messages with 
Kafka as buffer. We currently store this type as part of the Kafka message 
key so message consumers know which class to use for de-serialization.

I want to add the type to the serialized message in order to not rely on 
the existence of a separate key. I thought about creating a wrapper message 
like this:

message Header {
  enum PayloadType {
TYPE_ONE = 1;
TYPE_TWO = 2;
  }

  int64 tmst = 1;
  string message_id = 2;
  string producer_id = 3;
  PayloadType payload_type = 4;
}


// Any payload.
message MessageWrapper {
  Header header = 1;
  Any payload = 2;
}


or alternatively:

// List different payload options.
message MessageWrapper {
  Header header = 1;
  oneof payload {
PayloadTypeOne payload_type_one = 2;
PayloadTypeTwo payload_type_two = 3;
  }
}


My question: Is one of the two alternatives to be preferred?

Using Any leads to more complex setting/getting in the application code but 
it is more generic from the message definition point of view. Dropping the 
Header.PayloadType field in the definition using Any would allow me to not 
modify the MessageWrapper definition at all when adding new payload types.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Possible Protbuf cmake problem, or cmake bug

2016-05-16 Thread Robert Bielik
Hi all,

I'm using protobuf in our CMake based projects, and I've encountered a 
problem with TARGET_INCLUDE_DIRECTORIES not working as expected. Nominally 
if my target APP depens on libprotobuf, the PUBLIC part
of TARGET_INCLUDE_DIRECTORIES should propagate to target APP.

This does not work however, and the reason being is the install.cmake file 
in protobuf/cmake. The first section in install.cmake:

foreach(_library
  libprotobuf-lite
  libprotobuf
  libprotoc)
  set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$)
  install(TARGETS ${_library} EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()

messes up the TARGET_INCLUDE_DIRECTORIES declarations.

If I comment out include(install.cmake) (row 153 in CMakeLists.txt), 
everything works as expected and the include directory declarations are 
propagated correctly to the dependant targets.

Now, I don't know if this is a Protobuf CMake problem, or a bug in CMake 
itself. I'm leaning towards the latter.

Regards
/Robert

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Possible CMake bug, or Protobuf cmake problem.

2016-05-16 Thread Robert Bielik
Hi all,

We use the CMake files of Protobuf to include the libprotobuf target. 
However, in the Protobuf CMakeLists.txt file, the "include(install.cmake)" 
at bottom seems to mess up the target_include_directories directive
for libprotobuf, so that my targets do NOT get the specified include 
directories.

If I comment the "include(install.cmake)" row, everything works as 
expected. It might be the first part in install.cmake that is the culprit:

foreach(_library
  libprotobuf-lite
  libprotobuf
  libprotoc)
  set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$)
  install(TARGETS ${_library} EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()

Any ideas how to resolve this ? It may be a CMake bug though...

Regards
/Robert

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Recommended C# library and compiler for ProtoBuf 2.6.1 and build instructions for VS2015

2016-05-16 Thread Kiran Desai
We are evaluating Protobuf 2.6.1 for cross-language messaging. Primary 
languages are going to be C++, Java and C#.


   1. Is there a release date planned for ProtoBuf 3.0?
   2. Is the protobuf-csharp-port way to go for C# code (proto2)? If so, 
   will it work with VS2015?



-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Protobuf-Converter transforms Domain Model Objects into Google Protobuf Messages

2016-05-16 Thread Misha Mixailov
Hi all. Would anybody be interested in an Protobuf-Converter transforms 
Domain Model Objects into Google Protobuf Messages? 

How to use it ?

Domain model classes that have to be transformed into protobuf messages 
must satisfy conditions:

Class has to be marked by @ProtoClass annotaion that contains reference 
on related protobuf message class.
Class fields has to be marked by @ProtoField annotaion. These fields 
must have getters and setters.

E.g.:

@ProtoClass(ProtobufUser.class)
public class User {

@ProtoField
private String name;
@ProtoField
private String password;

// getters and setters for 'name' and 'password' fields
...
}

More information here https://github.com/BAData/protobuf-converter

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] encode repeated field without c++ api

2016-05-16 Thread Fezin ET
Hi All,

I am new to this google protobuf. I am using nanopb for my project. and not 
using cpp --cpp out compiler option.

I came across a message type which contains array of 10 structures. How can 
I fill data without cpp APIs. For eg:

message structA {
required float x = 3;
required float y = 2;
}

message myData {
   repeated uint32 Id = 8;
   repeated structA point = 1;
}

In my main program, I have 10 different points to fill in these myData. How 
can i do this ? How to fill myData.point[i].x looping i from 0 to 10?

Regards
Fezin

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] protobuf-dt required password from eclipse marketplace

2016-05-16 Thread workingmeloen

Me and a collegue have encountered this exact problem too, looking forward 
to the fix!
On Tuesday, 10 May 2016 00:35:36 UTC+2, Adam Cozzette wrote:
>
> Thanks for reporting this, Yan. I've passed this along to the team that 
> maintains the plugin; they were able to reproduce the problem and are 
> working on a fix now.
>
> On Sun, May 8, 2016 at 6:00 AM, Yan Yan  
> wrote:
>
>>
>> 
>>
>>
>> On Saturday, May 7, 2016 at 8:00:02 AM UTC+8, Adam Cozzette wrote:
>>>
>>> Could you provide some more detail on where a password was required?
>>>
>>> On Sun, May 1, 2016 at 7:34 PM, Yan Yan  wrote:
>>>
 It worked before. Now it required a password. Any idea? Thx.

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Protocol Buffers" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to protobuf+u...@googlegroups.com.
 To post to this group, send email to prot...@googlegroups.com.
 Visit this group at https://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Protobuf : How to generate the descriptor file dynamically from .proto

2016-05-16 Thread jigmesherab2016
Hi,

I wanted to generate FileDescriptor dynamically from .proto without 
referencing, as in the given example we have reference Student.Interop.DTO 
so that we can get the StudentDTO.Descriptor and EmployeeDTO.Descriptor, so 
i wanted to avoid this reference.

*Example :*
namespace Student.WebApi
{
using System.Web.Http;
using Framework.WebApi.Formatters;
using Google.Protobuf.Reflection;
using Repository;  
using Student.Interop.DTO;  

public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
var json = 
GlobalConfiguration.Configuration.Formatters.JsonFormatter;
json.SerializerSettings.Converters.Add(new 
AnyJsonConverter(TypeRegistry.FromMessages(StudentDTO.Descriptor, 
EmployeeDTO.Descriptor)));

}  
}
}

So to achieve this following few steps i tried :

*Step 1* : Sample Proto i.e Student.proto which consist of message type i.e 
StudentDTO 
and EmployeeDTO

syntax = "proto3";
package AnalysisConsoleApplication;
import "google/protobuf/any.proto";
option csharp_namespace = "AnalysisConsoleApplication";

message StudentDTO
{ google.protobuf.Any Any = 1;
string USN = 2; 
string Name = 3;
string University = 4;
}
message EmployeeDTO
{ 
string Name = 1;
string Gender = 2;
}

Step 2 : I generated Student.pb by using below command i.e 

.\protoc.exe --proto_path=D:\Proto Proto\Student.proto --include_imports 
--descriptor_set_out=D:\AnalysisConsoleApplication\Student.pb

Step 3 : If i reference Google.Protobuf.3.0.0-beta2 in my 
SampleConsoleApplication and try to use FileDescriptor class then it will 
give error as recently in updated version FileDescriptor  is of Internal 
sealed class. so i clone the Google.Protobuf repository which was of 
Google.Protobuf.3.0.0-beta2 release time, at that time FileDescriptor class 
was public sealed class. Now my SampleConsoleApplication  solution will 
have another project which is of Google.Protobuf.

Note: SampleConsoleApplication zip file is been attached for detail 
understanding.

This code is from Actual generated C# file(Student.cs) from the given 
proto, but now next step we will create this below descriptorData dynamically 
from Student.pb
byte[] descriptorData = global::System.Convert.FromBase64String(
  string.Concat(
"Cg1TdHVkZW50LnByb3RvEhpBbmFseXNpc0NvbnNvbGVBcHBsaWNhdGlvbhoZ",
"Z29vZ2xlL3Byb3RvYnVmL2FueS5wcm90byJeCgpTdHVkZW50RFRPEiEKA0Fu",
"eRgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnkSCwoDVVNOGAIgASgJEgwK",
"BE5hbWUYAyABKAkSEgoKVW5pdmVyc2l0eRgEIAEoCSIrCgtFbXBsb3llZURU",
"TxIMCgROYW1lGAEgASgJEg4KBkdlbmRlchgCIAEoCUIdqgIaQW5hbHlzaXND",
"b25zb2xlQXBwbGljYXRpb25iBnByb3RvMw=="));
  descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
  new pbr::FileDescriptor[] { 
global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, },
  new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
new 
pbr::GeneratedCodeInfo(typeof(global::AnalysisConsoleApplication.StudentDTO), 
global::AnalysisConsoleApplication.StudentDTO.Parser, new[]{ "Any", "USN", 
"Name", "University" }, null, null, null),
new 
pbr::GeneratedCodeInfo(typeof(global::AnalysisConsoleApplication.EmployeeDTO), 
global::AnalysisConsoleApplication.EmployeeDTO.Parser, new[]{ "Name", 
"Gender" }, null, null, null)
  }));

Step 4: Now to generate descriptorData  dynamically from Student.pb, i have 
written the following code which gives the descriptorData in byte[]

//get the path of Student.pb
var path = string.Format("{0}/Student.pb", Path.GetDirectoryName(new 
Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)); 
//create messageParser
MessageParser messageParser = new 
MessageParser(() => new FileDescriptorSet());
// open and read it
CodedInputStream stream = new CodedInputStream(new FileStream(path, 
FileMode.Open));
//Parses a message from the given coded input stream.
var data = messageParser .ParseFrom(stream);
//Covert to ByteString
var descriptorData  = data.File[0].ToByteString();   

Step 5: Last step to generate filedescriptor by calling 
FileDescriptor.FromGeneratedCode() 
which accepts 3 parameters
Parameter 1:  byte[] descriptorData -> this parameter we are able to 
generate dynamically as done in step 4 i.e   descriptorData.ToByteArray()  
 
Parameter 2:  FileDescriptor[] dependencies-> this takes all the 
dependencies.
Parameter 3: GeneratedCodeInfo generatedCodeInfo-> This has 
GeneratedCodeInfo(Type 
clrType, MessageParser parser, string[] propertyNames, string[] oneofNames, 
Type[] nestedEnums, GeneratedCodeInfo[] nestedTypes) out of this parameters 
i am not able to get clrtype dynamically.

*Here is the brief example of what i am expecting:*
typeof(global::SampleConsoleApplication.StudentDTO): this gives the type 

[protobuf] Protobuf-Converter transforms Domain Model Objects into Google Protobuf Messages

2016-05-16 Thread Misha Mixailov
Hi all. Would anybody be interested in an Protobuf-Converter transforms 
Domain Model Objects into Google Protobuf Messages? 

How to use it ?

Domain model classes that have to be transformed into protobuf messages 
must satisfy conditions:

Class has to be marked by @ProtoClass annotaion that contains reference 
on related protobuf message class.
Class fields has to be marked by @ProtoField annotaion. These fields 
must have getters and setters.

E.g.:

@ProtoClass(ProtobufUser.class)
public class User {

@ProtoField
private String name;
@ProtoField
private String password;

// getters and setters for 'name' and 'password' fields
...
}

More information here https://github.com/BAData/protobuf-converter

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Generated library language versions

2016-05-16 Thread Trent Billington
Where can I find information about which version of a target language is 
generated by the protobuf compilers? I can't find anything in the tutorials 
or reference information on the developers.google.com website.

I would like to know with protobuf3, which version of python, and php is 
generated by the official compilers. Php is not released yet but should be 
"soon" (https://github.com/google/protobuf/issues/358). Why is this 
important information left out of the protobuf website, or in a easier to 
find place if it is there?

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] How to erase particular field with MergeFrom()

2016-05-16 Thread Denis Bakhvalov
Hi,

Suppose I have such message structure:


package msg_RepAndOpt;

message RepAndOpt{
repeated string name = 1;
optional string surname = 2;
...
// there are lots of others.}


And I have two components that have copies of this message:


// component1:RepAndOpt A;
A.add_name("Name");
A.set_surname("Surname");
// component2:RepAndOpt B;


In my case components modify those messages via transaction mechanism. It 
means that if one component changes some field it also sends it to another 
component to propagate those changes. Component-receiver is doing merge:


// Component2 modifies B and sends it to component1.// Component1 perfoms merge:
A.MergeFrom(B);


Now, say, component2 wants to erase field "name". If it will send clear B 
message (default construction) than:

   - - MergeFrom() will not modify A;
   - - CopyFrom() will erase also other fields.

Another way will be to fill B with the contents of A, clear name field and 
component1 will use CopyFrom(). But this is not acceptable because system 
is really high-loaded and there could be lots of other fields. So, desired 
solution to clean name field is:

   1. 1. Component2 create B message.
   2. 2. Explicitly stores information that it want to erase only name 
   field.
   3. 3. Component1 perform A.MergeFrom(B).
   4. 4. Result: A::name is cleared but other fields are left untouched.

As far as I tested this applies to repeated and optional fields. Is there 
any ready-to-use solution or I should modify protobuf implementation?

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.