#include <BxUnion.h>
Inheritance diagram for BxUnion:

Public Member Functions | |
| BxUnion () | |
| BxUnion (const BxUnion ©) | |
| virtual char * | toString (bool xml) |
| virtual bool | toStream (FILE *) |
| virtual bool | toStreamBinary (FILE *) |
| void | setDiscriminant (BxDataObject *) |
| void | setAssignedCase (BxUnionCase *p) |
| void | setAssignedCase (int index) |
| void | setAssignedCase () |
| BxDataObject * | getDataObject () |
| void | addUnionCase (BxUnionCase *uc) |
| void | addUnionCase (const char *sDiscriminantValue, BxDataObject *pArmObject) |
<union blockSize="32" byteOrder="littleEndian">
<discriminant><byte-8 varName="bool"/></discriminant>
<case discriminantValue="1"><integer-32/></case>
<case discriminantValue="0"><double-64/></case>
</union>
|
|
Default constructor. Constructs an instance of the class BxUnion. All attribute values for this object are set to NULL. |
|
|
Construct a union object having attribute values identical to a specified instance of BxUnion.
Attributes of the new union instance are initialised by copying attribute values from the specified input union. Uninitialized attribute values in the input union result in NULL valued attributes in the new array instance. If the the input union contains union cases, new instances of BxUnionCase are created, values are copied from the input union to the new instances, and the new instances are added to an attribute of this object.
|
|
||||||||||||
|
Create a BxUnionCase and add to the collection. This method allows creating a BxUnionCase object by cloning a discriminant data object and set the value to the given parameter, and pass the second parameter to the arm data object.
|
|
|
Add a single, specified union case definition to the collection in a BxUnionCases object.
|
|
|
Read a data value from a binary data file based on the union cases defined in this object. This method reads a binary value of the appropriate data type from a binary data file. The appropriate data type is determined by matching a discriminate value against a set of union cases defined by a BinX document and stored in this BxUnion object. If the discriminate value has not been read from the binary data file, this method will:
|
|
|
Search the assigned case by checking the discriminant value. This method assumes that the cases are already added to the cases collection and the discriminant data object is also assigned to a real instance, and in addition, one of the the cases has the discriminant value equal to the discriminant object. It searches the cases to find the case with the discriminant value equal to the discriminant data object value and assign it to the assigned_ memeber variable. |
|
|
Set the assigned_ attribute of this object to reference the currently selected union case definition. The selected (matched) case value is indicated by an input index number, identifying the zero-based position of the matched case in the ordered collection of union cases options.
|
|
|
Set the assigned_ attribute of this object to reference the currently selected union case definition. The selected (matched) case value is indicated by an input pointer referencing a particular matched case value.
|
|
|
Set the discriminate_ attribute of this object to reference a specified value from a binary data file. The specified discriminate value (most recently read from a binary data file) is indicated by an input pointer referencing that value. If the union definition stored in this object has been previously applied to the binary data file, then the specified input value replaces the previously stored discriminate value. The old discriminate value is released. The new value is retained until it is later released by this same process.
|
|
|
Write a string containing the DataBinX representation of a union data type to a DataBinX file. The DataBinX representation of a BinX union data type includes:
Example Return Result:
<union>
<discriminant>
<byte-8>10</byte-8>
</discriminant>
<case discriminantValue="10">
...
</union>
The above example is broken over multiple lines for readability. This method writes a stream of consecutive bytes formed by the concatenation of the above substrings. The output example shows the BinX XML schema tags contained in the output. The discriminate value is an 8 byte quantity with value 10. The sequence of three dots at the end of the string represent the binary BinX XML tag for the data type, followed by the data value read from the binary data file, followed by the closing data type tag. The file must be open for writing in text mode.
Reimplemented from BxDataObject. |
|
|
Write the union discriminant data value and case value to a binary data file. The file must be open for writing in binary mode.
Reimplemented from BxDataObject. |
|
|
Return a string containing the DataBinX representation a union data type from a binary data file. The DataBinX representation of a BinX union data type includes:
Example Return Result:
<union>
<discriminant>
<byte-8>10</byte-8>
</discriminant>
<case discriminantValue="10">
...
</union>
This method allocates memory to hold the returned string. The caller is responsible for releasing the memory when the string is no longer needed. If the BinX XML tags are not required, then the input boolean flag can be used to request that only the converted binary data values be included in the result string.
Reimplemented from BxDataObject. |
1.3.3