diff options
Diffstat (limited to 'src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs | 124 |
1 files changed, 72 insertions, 52 deletions
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index 95704f49..58eff60f 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -122,7 +122,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _searchRequestFieldNames;
if (criteria_.Count > 0) {
output.WriteStringArray(1, field_names[0], criteria_);
@@ -135,22 +135,27 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- {
- int dataSize = 0;
- foreach (string element in CriteriaList) {
- dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
- }
- size += dataSize;
- size += 1 * criteria_.Count;
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ {
+ int dataSize = 0;
+ foreach (string element in CriteriaList) {
+ dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
+ }
+ size += dataSize;
+ size += 1 * criteria_.Count;
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static SearchRequest ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
@@ -450,7 +455,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _resultItemFieldNames;
if (hasUrl) {
output.WriteString(1, field_names[1], Url);
@@ -466,20 +471,25 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- if (hasUrl) {
- size += pb::CodedOutputStream.ComputeStringSize(1, Url);
- }
- if (hasName) {
- size += pb::CodedOutputStream.ComputeStringSize(2, Name);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasUrl) {
+ size += pb::CodedOutputStream.ComputeStringSize(1, Url);
+ }
+ if (hasName) {
+ size += pb::CodedOutputStream.ComputeStringSize(2, Name);
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static ResultItem ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
@@ -737,7 +747,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _searchResponseFieldNames;
if (results_.Count > 0) {
output.WriteMessageArray(1, field_names[0], results_);
@@ -750,17 +760,22 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
- size += pb::CodedOutputStream.ComputeMessageSize(1, element);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
+ size += pb::CodedOutputStream.ComputeMessageSize(1, element);
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static SearchResponse ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
@@ -1046,7 +1061,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _refineSearchRequestFieldNames;
if (criteria_.Count > 0) {
output.WriteStringArray(1, field_names[0], criteria_);
@@ -1062,25 +1077,30 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- {
- int dataSize = 0;
- foreach (string element in CriteriaList) {
- dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
- }
- size += dataSize;
- size += 1 * criteria_.Count;
- }
- if (hasPreviousResults) {
- size += pb::CodedOutputStream.ComputeMessageSize(2, PreviousResults);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ {
+ int dataSize = 0;
+ foreach (string element in CriteriaList) {
+ dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
+ }
+ size += dataSize;
+ size += 1 * criteria_.Count;
+ }
+ if (hasPreviousResults) {
+ size += pb::CodedOutputStream.ComputeMessageSize(2, PreviousResults);
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static RefineSearchRequest ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
|