[protobuf] Problem with configure/make in protobuf

2010-03-22 Thread Prasad
I am trying to compile/install protobuf. I have a solaris 10 and I read the README.txt and as per it, I did $ ./configure --prefix= LDFLAGS=-L$PWD/src/solaris it was still reading libstdc++.la from /usr/sfw/lib Then I set it to as per the comments I saw in src/solaris/libstdc++.la as follows. $

[protobuf] Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kevin Tambascio
Hi, I'm having trouble getting the following code to work. Using protoc.exe, I generated a file with the descriptor data using the -- descriptor_set_out file. I've written some Java code to read the file, and try to instantiate a default instance of one of the objects in the descriptor, so that

Re: [protobuf] Problem with configure/make in protobuf

2010-03-22 Thread Kenton Varda
On Sat, Mar 20, 2010 at 2:37 PM, Prasad wrote: > I am trying to compile/install protobuf. I have a solaris 10 and I > read the README.txt and as per it, > > I did > $ ./configure --prefix= LDFLAGS=-L$PWD/src/solaris > > it was still reading libstdc++.la from /usr/sfw/lib > > Then I set it to as p

[protobuf] Best method for "adding" to messages..

2010-03-22 Thread Olan
Hi all, I'm trying to write a protobuf to detect the RSSI values of some wireless stations in the area. I'm having some trouble 'updating' the RSSI value of a station if it has already been seen before. At the minute I'm doing a strcmp of the Station MAC from the message and the MAC retrieved from

[protobuf] File size of the serialized records

2010-03-22 Thread Vinit
I was testing to see the upper limit for numbers of records in one file. I used the addressbook example, and I noticed that for one record it generates file double the size. for ex. size of the class I was putting into it was 48 bytes and the file was of 97 bytes on ubuntu 9.10. Now, I go test it

Re: [protobuf] Best method for "adding" to messages..

2010-03-22 Thread Evan Jones
On Mar 22, 2010, at 14:00 , Olan wrote: const DIDS::Station& station_iter = stationlog.station(k); You probably want stationlog.mutable_station(k); See: http://code.google.com/apis/protocolbuffers/docs/reference/cpp-generated.html#fields Hope this helps, Evan -- Evan Jones http://e

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Jason Hsueh
If you're measuring using sizeof(), you won't account for memory allocated by subobjects (strings and submessages are stored as pointers). You should use Message::SpaceUsed() instead. The inmemory vs serialized size is going to depend on your proto definition and how you use it. If you have a lot o

Re: [protobuf] Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kenton Varda
DescriptorProto.getDescriptorForType() returns the Descriptor for DescriptorProto, not for the type which that DescriptorProto is describing. Remember that DescriptorProto is just a protocol message like any other -- it does not have any special methods that recognize its higher-level meaning. To

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Vinit Mahedia
Hi Jason, Thanks for the quick reply. I am not surprised by the increase in file size, But I am under impression that If I insert the same record thousand times, the size of file should be large accordingly, e.g, assume that one record generates the file of size 32 bytes; with1024 records should

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Daniel Wright
The most likely cause is a bug in your code where there's something you aren't clearing each time you write a record, so at each iteration in your loop, the record you're writing is getting bigger. Of course I can't say for sure without seeing the code. Daniel On Mon, Mar 22, 2010 at 1:13 PM, Vi

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Vinit Mahedia
I am using add_person.cc provided in the sample file. The only change I have done is, a while loop around this code. So it's same record inserted multiple times. // Write the new address book back to disk.fstream output(argv[1], ios::out | ios::trunc | ios::binary); *int nRecords = 10;* *whil

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Kenton Varda
That's not the right way to write multiple records. What you're doing is writing multiple address books without proper boundaries between them. The right thing to do would be to add multiple "person"s to one address book, then write it once. That said, the file produced by your code should grow

[protobuf] Re: Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kevin Tambascio
Kenton, I did make some more progress today, along the lines of what you said below. I'm seeing an issue where calling DynamicMessage.getDefaultInstance(type) is not filling in the default values. This is with 2.3.0 of GPB. My proto file: message StringTableEntry { required string lang = 1

Re: [protobuf] Re: Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kenton Varda
"required" means "If this field is not explicitly set before build() is called, or if parseFrom() parses a message missing this field, throw an exception.". It does NOT mean "Automatically fill in this field.". Please point me at any documentation which suggests the latter meaning so I can fix it

[protobuf] Re: Issue 174 in protobuf: RFE: Allow service defs in optimize_for=LITE_RUNTIME if *_generic_service = false

2010-03-22 Thread protobuf
Updates: Status: Accepted Comment #1 on issue 174 by ken...@google.com: RFE: Allow service defs in optimize_for=LITE_RUNTIME if *_generic_service = false http://code.google.com/p/protobuf/issues/detail?id=174 Yep, this is an artifact of lite mode having been implemented before plugi

[protobuf] Re: Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kevin Tambascio
Kenton, This description in the MessageLite documentation is what led me to believe the default values would be there. I figured I was misinterpreting the documentation, or the meaning behind the default value: getDefaultInstanceForType MessageLite getDefaultInstanceForType() Get an instance of

Re: [protobuf] Re: Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kenton Varda
Yeah, I can see how that is misleading (though it does not mention "required" fields -- it claims all fields). It should say "Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty

Re: [protobuf] Re: Creating an instance of a message from the descriptor (java)

2010-03-22 Thread Kenton Varda
http://code.google.com/p/protobuf/issues/detail?id=175 On Mon, Mar 22, 2010 at 4:59 PM, Kenton Varda wrote: > Yeah, I can see how that is misleading (though it does not mention > "required" fields -- it claims all fields). It should say "Get an instance > of the type with no fields set. Becaus

[protobuf] Issue 175 in protobuf: getDefaultInstanceForType() docs slightly misleading

2010-03-22 Thread protobuf
Status: Accepted Owner: ken...@google.com Labels: Type-Defect Priority-Medium New issue 175 by ken...@google.com: getDefaultInstanceForType() docs slightly misleading http://code.google.com/p/protobuf/issues/detail?id=175 Documentation for getDefaultInstanceForType() says "Get an instance of