Avro C++
|
Generic container for unions. More...
#include <Generic.hh>
Public Member Functions | |
GenericUnion (const NodePtr &schema) | |
Constructs a generic union corresponding to the given schema schema , and the given value. | |
size_t | currentBranch () const |
Returns the index of the current branch. | |
void | selectBranch (size_t branch) |
Selects a new branch. | |
Type | type () const |
Returns the type for currently selected branch in this union. | |
template<typename T > | |
const T & | value () const |
Returns the value in this union. | |
template<typename T > | |
T & | value () |
Returns the reference to the value in this union. |
Generic container for unions.
avro::GenericUnion::GenericUnion | ( | const NodePtr & | schema | ) | [inline] |
Constructs a generic union corresponding to the given schema schema
, and the given value.
The schema should be of Avro type union and the value should correspond to one of the branches of the union.
void avro::GenericUnion::selectBranch | ( | size_t | branch | ) | [inline] |
Selects a new branch.
The type for the value is changed accordingly.
branch | The index for the selected branch. |