choice.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:20k
源码类别:

生物技术

开发平台:

C/C++

  1. /*
  2.  * ===========================================================================
  3.  * PRODUCTION $Log: choice.cpp,v $
  4.  * PRODUCTION Revision 1000.2  2004/06/01 19:39:50  gouriano
  5.  * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.38
  6.  * PRODUCTION
  7.  * ===========================================================================
  8.  */
  9. /*  $Id: choice.cpp,v 1000.2 2004/06/01 19:39:50 gouriano Exp $
  10. * ===========================================================================
  11. *
  12. *                            PUBLIC DOMAIN NOTICE
  13. *               National Center for Biotechnology Information
  14. *
  15. *  This software/database is a "United States Government Work" under the
  16. *  terms of the United States Copyright Act.  It was written as part of
  17. *  the author's official duties as a United States Government employee and
  18. *  thus cannot be copyrighted.  This software/database is freely available
  19. *  to the public for use. The National Library of Medicine and the U.S.
  20. *  Government have not placed any restriction on its use or reproduction.
  21. *
  22. *  Although all reasonable efforts have been taken to ensure the accuracy
  23. *  and reliability of the software and data, the NLM and the U.S.
  24. *  Government do not and cannot warrant the performance or results that
  25. *  may be obtained by using this software or data. The NLM and the U.S.
  26. *  Government disclaim all warranties, express or implied, including
  27. *  warranties of performance, merchantability or fitness for any particular
  28. *  purpose.
  29. *
  30. *  Please cite the author in any work or product based on this material.
  31. *
  32. * ===========================================================================
  33. *
  34. * Author: Eugene Vasilchenko
  35. *
  36. * File Description:
  37. *   !!! PUT YOUR DESCRIPTION HERE !!!
  38. *
  39. * ---------------------------------------------------------------------------
  40. * $Log: choice.cpp,v $
  41. * Revision 1000.2  2004/06/01 19:39:50  gouriano
  42. * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.38
  43. *
  44. * Revision 1.38  2004/05/17 21:03:02  gorelenk
  45. * Added include of PCH ncbi_pch.hpp
  46. *
  47. * Revision 1.37  2004/03/25 15:57:08  gouriano
  48. * Added possibility to copy and compare serial object non-recursively
  49. *
  50. * Revision 1.36  2004/01/05 14:25:19  gouriano
  51. * Added possibility to set serialization hooks by stack path
  52. *
  53. * Revision 1.35  2003/05/16 18:02:18  gouriano
  54. * revised exception error messages
  55. *
  56. * Revision 1.34  2003/04/29 18:30:36  gouriano
  57. * object data member initialization verification
  58. *
  59. * Revision 1.33  2002/12/26 19:32:32  gouriano
  60. * changed XML I/O streams to properly handle object copying
  61. *
  62. * Revision 1.32  2002/12/12 21:08:07  gouriano
  63. * implemented handling of complex XML containers
  64. *
  65. * Revision 1.31  2002/11/14 20:55:47  gouriano
  66. * added support of XML attribute lists
  67. *
  68. * Revision 1.30  2002/10/25 14:49:27  vasilche
  69. * NCBI C Toolkit compatibility code extracted to libxcser library.
  70. * Serial streams flags names were renamed to fXxx.
  71. *
  72. * Names of flags
  73. *
  74. * Revision 1.29  2002/05/22 14:03:42  grichenk
  75. * CSerialUserOp -- added prefix UserOp_ to Assign() and Equals()
  76. *
  77. * Revision 1.28  2001/07/25 19:13:04  grichenk
  78. * Check if the object is CObject-derived before dynamic cast
  79. *
  80. * Revision 1.27  2001/07/16 16:22:51  grichenk
  81. * Added CSerialUserOp class to create Assign() and Equals() methods for
  82. * user-defind classes.
  83. * Added SerialAssign<>() and SerialEquals<>() functions.
  84. *
  85. * Revision 1.26  2001/05/17 15:07:04  lavr
  86. * Typos corrected
  87. *
  88. * Revision 1.25  2001/01/05 20:10:50  vasilche
  89. * CByteSource, CIStrBuffer, COStrBuffer, CLightString, CChecksum, CWeakMap
  90. * were moved to util.
  91. *
  92. * Revision 1.24  2000/10/20 15:51:37  vasilche
  93. * Fixed data error processing.
  94. * Added interface for constructing container objects directly into output stream.
  95. * object.hpp, object.inl and object.cpp were split to
  96. * objectinfo.*, objecttype.*, objectiter.* and objectio.*.
  97. *
  98. * Revision 1.23  2000/10/13 20:22:53  vasilche
  99. * Fixed warnings on 64 bit compilers.
  100. * Fixed missing typename in templates.
  101. *
  102. * Revision 1.22  2000/09/26 17:38:20  vasilche
  103. * Fixed incomplete choiceptr implementation.
  104. * Removed temporary comments.
  105. *
  106. * Revision 1.21  2000/09/18 20:00:20  vasilche
  107. * Separated CVariantInfo and CMemberInfo.
  108. * Implemented copy hooks.
  109. * All hooks now are stored in CTypeInfo/CMemberInfo/CVariantInfo.
  110. * Most type specific functions now are implemented via function pointers instead of virtual functions.
  111. *
  112. * Revision 1.20  2000/09/01 13:16:14  vasilche
  113. * Implemented class/container/choice iterators.
  114. * Implemented CObjectStreamCopier for copying data without loading into memory.
  115. *
  116. * Revision 1.19  2000/08/15 19:44:46  vasilche
  117. * Added Read/Write hooks:
  118. * CReadObjectHook/CWriteObjectHook for objects of specified type.
  119. * CReadClassMemberHook/CWriteClassMemberHook for specified members.
  120. * CReadChoiceVariantHook/CWriteChoiceVariant for specified choice variants.
  121. * CReadContainerElementHook/CWriteContainerElementsHook for containers.
  122. *
  123. * Revision 1.18  2000/07/03 18:42:42  vasilche
  124. * Added interface to typeinfo via CObjectInfo and CConstObjectInfo.
  125. * Reduced header dependency.
  126. *
  127. * Revision 1.17  2000/06/16 16:31:17  vasilche
  128. * Changed implementation of choices and classes info to allow use of the same classes in generated and user written classes.
  129. *
  130. * Revision 1.16  2000/06/07 19:45:57  vasilche
  131. * Some code cleaning.
  132. * Macros renaming in more clear way.
  133. * BEGIN_NAMED_*_INFO, ADD_*_MEMBER, ADD_NAMED_*_MEMBER.
  134. *
  135. * Revision 1.15  2000/06/01 19:07:02  vasilche
  136. * Added parsing of XML data.
  137. *
  138. * Revision 1.14  2000/05/24 20:08:46  vasilche
  139. * Implemented XML dump.
  140. *
  141. * Revision 1.13  2000/05/09 16:38:37  vasilche
  142. * CObject::GetTypeInfo now moved to CObjectGetTypeInfo::GetTypeInfo to reduce possible errors.
  143. * Added write context to CObjectOStream.
  144. * Inlined most of methods of helping class Member, Block, ByteBlock etc.
  145. *
  146. * Revision 1.12  2000/04/28 16:58:12  vasilche
  147. * Added classes CByteSource and CByteSourceReader for generic reading.
  148. * Added delayed reading of choice variants.
  149. *
  150. * Revision 1.11  2000/04/10 21:01:48  vasilche
  151. * Fixed Erase for map/set.
  152. * Added iteratorbase.hpp header for basic internal classes.
  153. *
  154. * Revision 1.10  2000/04/06 16:10:58  vasilche
  155. * Fixed bug with iterators in choices.
  156. * Removed unneeded calls to ReadExternalObject/WriteExternalObject.
  157. * Added output buffering to text ASN.1 data.
  158. *
  159. * Revision 1.9  2000/04/03 18:47:26  vasilche
  160. * Added main include file for generated headers.
  161. * serialimpl.hpp is included in generated sources with GetTypeInfo methods
  162. *
  163. * Revision 1.8  2000/03/14 14:42:29  vasilche
  164. * Fixed error reporting.
  165. *
  166. * Revision 1.7  2000/03/07 14:06:21  vasilche
  167. * Added stream buffering to ASN.1 binary input.
  168. * Optimized class loading/storing.
  169. * Fixed bugs in processing OPTIONAL fields.
  170. * Added generation of reference counted objects.
  171. *
  172. * Revision 1.6  2000/02/17 20:02:42  vasilche
  173. * Added some standard serialization exceptions.
  174. * Optimized text/binary ASN.1 reading.
  175. * Fixed wrong encoding of StringStore in ASN.1 binary format.
  176. * Optimized logic of object collection.
  177. *
  178. * Revision 1.5  2000/02/01 21:47:21  vasilche
  179. * Added CGeneratedChoiceTypeInfo for generated choice classes.
  180. * Added buffering to CObjectIStreamAsn.
  181. * Removed CMemberInfo subclasses.
  182. * Added support for DEFAULT/OPTIONAL members.
  183. *
  184. * Revision 1.4  2000/01/10 19:46:38  vasilche
  185. * Fixed encoding/decoding of REAL type.
  186. * Fixed encoding/decoding of StringStore.
  187. * Fixed encoding/decoding of NULL type.
  188. * Fixed error reporting.
  189. * Reduced object map (only classes).
  190. *
  191. * Revision 1.3  2000/01/05 19:43:51  vasilche
  192. * Fixed error messages when reading from ASN.1 binary file.
  193. * Fixed storing of integers with enumerated values in ASN.1 binary file.
  194. * Added TAG support to key/value of map.
  195. * Added support of NULL variant in CHOICE.
  196. *
  197. * Revision 1.2  1999/12/17 19:05:01  vasilche
  198. * Simplified generation of GetTypeInfo methods.
  199. *
  200. * Revision 1.1  1999/09/24 18:20:07  vasilche
  201. * Removed dependency on NCBI toolkit.
  202. *
  203. * ===========================================================================
  204. */
  205. #include <ncbi_pch.hpp>
  206. #include <serial/choice.hpp>
  207. #include <serial/objostr.hpp>
  208. #include <serial/objistr.hpp>
  209. #include <serial/objcopy.hpp>
  210. #include <serial/variant.hpp>
  211. #include <serial/delaybuf.hpp>
  212. #include <serial/serialbase.hpp>
  213. BEGIN_NCBI_SCOPE
  214. class CChoiceTypeInfoFunctions
  215. {
  216. public:
  217.     static void ReadChoiceDefault(CObjectIStream& in,
  218.                                   TTypeInfo objectType,
  219.                                   TObjectPtr objectPtr);
  220.     static void WriteChoiceDefault(CObjectOStream& out,
  221.                                    TTypeInfo objectType,
  222.                                    TConstObjectPtr objectPtr);
  223.     static void SkipChoiceDefault(CObjectIStream& in,
  224.                                   TTypeInfo objectType);
  225.     static void CopyChoiceDefault(CObjectStreamCopier& copier,
  226.                                   TTypeInfo objectType);
  227. };
  228. typedef CChoiceTypeInfoFunctions TFunc;
  229. CChoiceTypeInfo::CChoiceTypeInfo(size_t size, const char* name, 
  230.                                  const void* nonCObject,
  231.                                  TTypeCreate createFunc,
  232.                                  const type_info& ti,
  233.                                  TWhichFunction whichFunc,
  234.                                  TSelectFunction selectFunc,
  235.                                  TResetFunction resetFunc)
  236.     : CParent(eTypeFamilyChoice, size, name, nonCObject, createFunc, ti),
  237.       m_WhichFunction(whichFunc),
  238.       m_ResetFunction(resetFunc), m_SelectFunction(selectFunc)
  239. {
  240.     InitChoiceTypeInfoFunctions();
  241. }
  242. CChoiceTypeInfo::CChoiceTypeInfo(size_t size, const char* name,
  243.                                  const CObject* cObject,
  244.                                  TTypeCreate createFunc,
  245.                                  const type_info& ti,
  246.                                  TWhichFunction whichFunc,
  247.                                  TSelectFunction selectFunc,
  248.                                  TResetFunction resetFunc)
  249.     : CParent(eTypeFamilyChoice, size, name, cObject, createFunc, ti),
  250.       m_WhichFunction(whichFunc),
  251.       m_ResetFunction(resetFunc), m_SelectFunction(selectFunc)
  252. {
  253.     InitChoiceTypeInfoFunctions();
  254. }
  255. CChoiceTypeInfo::CChoiceTypeInfo(size_t size, const string& name, 
  256.                                  const void* nonCObject,
  257.                                  TTypeCreate createFunc,
  258.                                  const type_info& ti,
  259.                                  TWhichFunction whichFunc,
  260.                                  TSelectFunction selectFunc,
  261.                                  TResetFunction resetFunc)
  262.     : CParent(eTypeFamilyChoice, size, name, nonCObject, createFunc, ti),
  263.       m_WhichFunction(whichFunc),
  264.       m_ResetFunction(resetFunc), m_SelectFunction(selectFunc)
  265. {
  266.     InitChoiceTypeInfoFunctions();
  267. }
  268. CChoiceTypeInfo::CChoiceTypeInfo(size_t size, const string& name,
  269.                                  const CObject* cObject,
  270.                                  TTypeCreate createFunc,
  271.                                  const type_info& ti,
  272.                                  TWhichFunction whichFunc,
  273.                                  TSelectFunction selectFunc,
  274.                                  TResetFunction resetFunc)
  275.     : CParent(eTypeFamilyChoice, size, name, cObject, createFunc, ti),
  276.       m_WhichFunction(whichFunc),
  277.       m_ResetFunction(resetFunc), m_SelectFunction(selectFunc)
  278. {
  279.     InitChoiceTypeInfoFunctions();
  280. }
  281. void CChoiceTypeInfo::InitChoiceTypeInfoFunctions(void)
  282. {
  283.     SetReadFunction(&TFunc::ReadChoiceDefault);
  284.     SetWriteFunction(&TFunc::WriteChoiceDefault);
  285.     SetCopyFunction(&TFunc::CopyChoiceDefault);
  286.     SetSkipFunction(&TFunc::SkipChoiceDefault);
  287.     m_SelectDelayFunction = 0;
  288. }
  289. CVariantInfo* CChoiceTypeInfo::AddVariant(const char* memberId,
  290.                                           const void* memberPtr,
  291.                                           const CTypeRef& memberType)
  292. {
  293.     CVariantInfo* variantInfo = new CVariantInfo(this, memberId,
  294.                                                  TPointerOffsetType(memberPtr),
  295.                                                  memberType);
  296.     GetItems().AddItem(variantInfo);
  297.     return variantInfo;
  298. }
  299. CVariantInfo* CChoiceTypeInfo::AddVariant(const CMemberId& memberId,
  300.                                           const void* memberPtr,
  301.                                           const CTypeRef& memberType)
  302. {
  303.     CVariantInfo* variantInfo = new CVariantInfo(this, memberId,
  304.                                                  TPointerOffsetType(memberPtr),
  305.                                                  memberType);
  306.     GetItems().AddItem(variantInfo);
  307.     return variantInfo;
  308. }
  309. bool CChoiceTypeInfo::IsDefault(TConstObjectPtr object) const
  310. {
  311.     return GetIndex(object) == kEmptyChoice;
  312. }
  313. static inline
  314. TObjectPtr GetMember(const CMemberInfo* memberInfo, TObjectPtr object)
  315. {
  316.     if ( memberInfo->CanBeDelayed() )
  317.         memberInfo->GetDelayBuffer(object).Update();
  318.     return memberInfo->GetItemPtr(object);
  319. }
  320. static inline
  321. TConstObjectPtr GetMember(const CMemberInfo* memberInfo,
  322.                           TConstObjectPtr object)
  323. {
  324.     if ( memberInfo->CanBeDelayed() )
  325.         const_cast<CDelayBuffer&>(memberInfo->GetDelayBuffer(object)).Update();
  326.     return memberInfo->GetItemPtr(object);
  327. }
  328. bool CChoiceTypeInfo::Equals(TConstObjectPtr object1, TConstObjectPtr object2,
  329.                              ESerialRecursionMode how) const
  330. {
  331.     // User defined comparison
  332.     if ( IsCObject() ) {
  333.         const CSerialUserOp* op1 =
  334.             dynamic_cast<const CSerialUserOp*>
  335.             (static_cast<const CObject*>(object1));
  336.         const CSerialUserOp* op2 =
  337.             dynamic_cast<const CSerialUserOp*>
  338.             (static_cast<const CObject*>(object2));
  339.         if ( op1  &&  op2 ) {
  340.             if ( !op1->UserOp_Equals(*op2) )
  341.                 return false;
  342.         }
  343.     }
  344.     TMemberIndex index;
  345.     index = GetVariants().FirstIndex();
  346.     const CVariantInfo* variantInfo = GetVariantInfo(index);
  347.     if (variantInfo->GetId().IsAttlist()) {
  348.         const CMemberInfo* info =
  349.             dynamic_cast<const CMemberInfo*>(GetVariants().GetItemInfo(index));
  350.         if ( !info->GetTypeInfo()->Equals(GetMember(info, object1),
  351.                                           GetMember(info, object2), how) ) {
  352.             return false;
  353.         }
  354.     }
  355.     // Default comparison
  356.     index = GetIndex(object1);
  357.     if ( index != GetIndex(object2) )
  358.         return false;
  359.     if ( index == kEmptyChoice )
  360.         return true;
  361.     return
  362.         GetVariantInfo(index)->GetTypeInfo()->Equals(GetData(object1, index),
  363.                                                      GetData(object2, index), how);
  364. }
  365. void CChoiceTypeInfo::SetDefault(TObjectPtr dst) const
  366. {
  367.     ResetIndex(dst);
  368. }
  369. void CChoiceTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
  370.                              ESerialRecursionMode how) const
  371. {
  372.     TMemberIndex index;
  373.     index = GetVariants().FirstIndex();
  374.     const CVariantInfo* variantInfo = GetVariantInfo(index);
  375.     if (variantInfo->GetId().IsAttlist()) {
  376.         const CMemberInfo* info =
  377.             dynamic_cast<const CMemberInfo*>(GetVariants().GetItemInfo(index));
  378.         info->GetTypeInfo()->Assign(GetMember(info, dst),
  379.                                     GetMember(info, src),how);
  380.     }
  381.     index = GetIndex(src);
  382.     if ( index == kEmptyChoice )
  383.         ResetIndex(dst);
  384.     else {
  385.         _ASSERT(index >= GetVariants().FirstIndex() && 
  386.                 index <= GetVariants().LastIndex());
  387.         SetIndex(dst, index);
  388.         GetVariantInfo(index)->GetTypeInfo()->Assign(GetData(dst, index),
  389.                                                      GetData(src, index), how);
  390.     }
  391.     // User defined assignment
  392.     if ( IsCObject() ) {
  393.         const CSerialUserOp* opsrc =
  394.             dynamic_cast<const CSerialUserOp*>
  395.             (static_cast<const CObject*>(src));
  396.         CSerialUserOp* opdst =
  397.             dynamic_cast<CSerialUserOp*>
  398.             (static_cast<CObject*>(dst));
  399.         if ( opdst  &&  opsrc ) {
  400.             opdst->UserOp_Assign(*opsrc);
  401.         }
  402.     }
  403. }
  404. void CChoiceTypeInfo::SetSelectDelayFunction(TSelectDelayFunction func)
  405. {
  406.     _ASSERT(m_SelectDelayFunction == 0);
  407.     _ASSERT(func != 0);
  408.     m_SelectDelayFunction = func;
  409. }
  410. void CChoiceTypeInfo::SetDelayIndex(TObjectPtr objectPtr,
  411.                                     TMemberIndex index) const
  412. {
  413.     m_SelectDelayFunction(this, objectPtr, index);
  414. }
  415. void CChoiceTypeInfoFunctions::ReadChoiceDefault(CObjectIStream& in,
  416.                                                  TTypeInfo objectType,
  417.                                                  TObjectPtr objectPtr)
  418. {
  419.     const CChoiceTypeInfo* choiceType =
  420.         CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
  421.     BEGIN_OBJECT_FRAME_OF2(in, eFrameChoice, choiceType);
  422.     in.BeginChoice(choiceType);
  423.     BEGIN_OBJECT_FRAME_OF(in, eFrameChoiceVariant);
  424.     TMemberIndex index = in.BeginChoiceVariant(choiceType);
  425.     if ( index == kInvalidMember )
  426.         in.ThrowError(in.fFormatError, "choice variant id expected");
  427.     const CVariantInfo* variantInfo = choiceType->GetVariantInfo(index);
  428.     if (variantInfo->GetId().IsAttlist()) {
  429.         const CMemberInfo* memberInfo =
  430.             dynamic_cast<const CMemberInfo*>(
  431.                 choiceType->GetVariants().GetItemInfo(index));
  432.         memberInfo->ReadMember(in,objectPtr);
  433.         index = in.BeginChoiceVariant(choiceType);
  434.         if ( index == kInvalidMember )
  435.             in.ThrowError(in.fFormatError, "choice variant id expected");
  436.         variantInfo = choiceType->GetVariantInfo(index);
  437.     }
  438.     in.SetTopMemberId(variantInfo->GetId());
  439.     variantInfo->ReadVariant(in, objectPtr);
  440.     in.EndChoiceVariant();
  441.     END_OBJECT_FRAME_OF(in);
  442.     in.EndChoice();
  443.     END_OBJECT_FRAME_OF(in);
  444. }
  445. void CChoiceTypeInfoFunctions::WriteChoiceDefault(CObjectOStream& out,
  446.                                                   TTypeInfo objectType,
  447.                                                   TConstObjectPtr objectPtr)
  448. {
  449.     const CChoiceTypeInfo* choiceType =
  450.         CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
  451.     BEGIN_OBJECT_FRAME_OF2(out, eFrameChoice, choiceType);
  452.     out.BeginChoice(choiceType);
  453.     TMemberIndex index = choiceType->GetVariants().FirstIndex();
  454.     const CVariantInfo* variantInfo = choiceType->GetVariantInfo(index);
  455.     if (variantInfo->GetId().IsAttlist()) {
  456.         const CMemberInfo* memberInfo =
  457.             dynamic_cast<const CMemberInfo*>(
  458.                 choiceType->GetVariants().GetItemInfo(index));
  459.         memberInfo->WriteMember(out,objectPtr);
  460.     }
  461.     index = choiceType->GetIndex(objectPtr);
  462.     if ( index == kInvalidMember )
  463.         out.ThrowError(out.fIllegalCall, "cannot write empty choice");
  464.     variantInfo = choiceType->GetVariantInfo(index);
  465.     BEGIN_OBJECT_FRAME_OF2(out, eFrameChoiceVariant, variantInfo->GetId());
  466.     out.BeginChoiceVariant(choiceType, variantInfo->GetId());
  467.     variantInfo->WriteVariant(out, objectPtr);
  468.     out.EndChoiceVariant();
  469.     END_OBJECT_FRAME_OF(out);
  470.     out.EndChoice();
  471.     END_OBJECT_FRAME_OF(out);
  472. }
  473. void CChoiceTypeInfoFunctions::CopyChoiceDefault(CObjectStreamCopier& copier,
  474.                                                  TTypeInfo objectType)
  475. {
  476.     copier.CopyChoice(CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType));
  477. }
  478. void CChoiceTypeInfoFunctions::SkipChoiceDefault(CObjectIStream& in,
  479.                                                  TTypeInfo objectType)
  480. {
  481.     const CChoiceTypeInfo* choiceType =
  482.         CTypeConverter<CChoiceTypeInfo>::SafeCast(objectType);
  483.     BEGIN_OBJECT_FRAME_OF2(in, eFrameChoice, choiceType);
  484.     in.BeginChoice(choiceType);
  485.     BEGIN_OBJECT_FRAME_OF(in, eFrameChoiceVariant);
  486.     TMemberIndex index = in.BeginChoiceVariant(choiceType);
  487.     if ( index == kInvalidMember )
  488.         in.ThrowError(in.fFormatError,"choice variant id expected");
  489.     const CVariantInfo* variantInfo = choiceType->GetVariantInfo(index);
  490.     if (variantInfo->GetId().IsAttlist()) {
  491.         const CMemberInfo* memberInfo =
  492.             dynamic_cast<const CMemberInfo*>(
  493.                 choiceType->GetVariants().GetItemInfo(index));
  494.         memberInfo->SkipMember(in);
  495.         index = in.BeginChoiceVariant(choiceType);
  496.         if ( index == kInvalidMember )
  497.             in.ThrowError(in.fFormatError,"choice variant id expected");
  498.         variantInfo = choiceType->GetVariantInfo(index);
  499.     }
  500.     in.SetTopMemberId(variantInfo->GetId());
  501.     variantInfo->SkipVariant(in);
  502.     in.EndChoiceVariant();
  503.     END_OBJECT_FRAME_OF(in);
  504.     in.EndChoice();
  505.     END_OBJECT_FRAME_OF(in);
  506. }
  507. END_NCBI_SCOPE