
C++ Example
class AOrBOrBothType_1x1 : public OSBaseType { public: struct { unsigned bPresent : 1; } m; OSXMLStringClass a; OSXMLStringClass b; ... } ; class AOrBOrBothType : public OSBaseType { public: // tag constants enum { T__seq1 = 1, T_b = 2 } ; OSUINT16 t; union { /* t = 1 */ AOrBOrBothType_1x1 *_seq1; /* t = 2 */ OSXMLStringClass *b; } u; ... inline AOrBOrBothType_1x1* get__seq1 () { return u._seq1; } inline OSBOOL is__seq1 () { return (t == T__seq1); } void set__seq1 (const AOrBOrBothType_1x1& value); inline OSXMLStringClass* get_b () { return u.b; } inline OSBOOL is_b () { return (t == T_b); } void set_b (const OSXMLStringClass& value); } ;This shows the generated get/set methods as well as the generated member variables in the class. If the user wanted to set the class to the nested sequence value, the set__seq1 method could be used. If the user wanted to determine if the b element was selected in the class and then get the value, the following code snippet could be used (object is assumed to be an instance of the AOrBOrBothType class):
if (object.is_b()) { OSXMLStringClass* value = object.get_b(); }
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |