-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* AVRO-3984 [C++] Getters created by avrogencpp return a reference instead of a value to avoid calling copy constructor of large classes * AVRO-3984 [C++] Add getter for generated unions that returns a mutable reference. This allows the user to modify values in union branches after creation (#3047) * AVRO-3984 [C++] Add move setters for generated unions to provide a more efficient way to set a value (#3047) * AVRO-3984 [C++] Use std::move in decode implementation of codec_traits for unions to avoid a copy (#3047) * AVRO-3984 [C++] Generate an enum for each union type that maps the branch names to the corresponding index. This allows the user to avoid checks against "magic numbers" (#3047) * AVRO-3984 [C++] Add additional checks for the union branch in testUnionMethods test (#3047) * AVRO-3984 [C++] Add additional branch() method that returns the Branch enum directly, this avoids a manual static_cast (#3047) --------- Co-authored-by: hwse <a35winuuvvbpa@mailbox.org>
- Loading branch information
Showing
4 changed files
with
265 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"type": "record", | ||
"doc": "Top level Doc.", | ||
"name": "RootRecord", | ||
"fields": [ | ||
{ | ||
"name": "big_union", | ||
"doc": "A large union containing the primitive types, a array, a map and records.", | ||
"type": [ | ||
"null", | ||
"boolean", | ||
"int", | ||
"long", | ||
"float", | ||
"double", | ||
{ | ||
"type": "fixed", | ||
"size": 16, | ||
"name": "MD5" | ||
}, | ||
"string", | ||
{ | ||
"type": "record", | ||
"name": "Vec2", | ||
"fields": [ | ||
{ | ||
"name": "x", | ||
"type": "long" | ||
}, | ||
{ | ||
"name": "y", | ||
"type": "long" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "Vec3", | ||
"fields": [ | ||
{ | ||
"name": "x", | ||
"type": "long" | ||
}, | ||
{ | ||
"name": "y", | ||
"type": "long" | ||
}, | ||
{ | ||
"name": "z", | ||
"type": "long" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "enum", | ||
"name": "Suit", | ||
"symbols": [ | ||
"SPADES", | ||
"HEARTS", | ||
"DIAMONDS", | ||
"CLUBS" | ||
] | ||
}, | ||
{ | ||
"type": "array", | ||
"items": "string", | ||
"default": [] | ||
}, | ||
{ | ||
"type": "map", | ||
"values": "long", | ||
"default": {} | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "int_", | ||
"doc": "try to force a collision with int", | ||
"fields": [] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "int__", | ||
"doc": "try to force a collision with int", | ||
"fields": [] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "Int", | ||
"doc": "name similar to primitive name", | ||
"fields": [] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "_Int", | ||
"doc": "name with underscore as prefix", | ||
"fields": [] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters