NCBI C++ ToolKit
ObjectList_.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id$
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * File Description:
27  * This code was generated by application DATATOOL
28  * using the following specifications:
29  * 'linkout.dtd'.
30  *
31  * ATTENTION:
32  * Don't edit or commit this file into CVS as this file will
33  * be overridden (by DATATOOL) without warning!
34  * ===========================================================================
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/serialimpl.hpp>
40 
41 // generated includes
44 BEGIN_linkout_SCOPE // namespace linkout::
45 
46 
47 // generated classes
48 
50 {
51  if ( m_choice != e_not_set )
53 }
54 
56 {
57  switch ( m_choice ) {
58  case e_Query:
59  case e_ObjId:
60  m_string.Destruct();
61  break;
62  case e_FileName:
63  m_object->RemoveReference();
64  break;
65  default:
66  break;
67  }
68  m_choice = e_not_set;
69 }
70 
71 void CObjectList_Base::C_Data::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
72 {
73  switch ( index ) {
74  case e_FileName:
75  (m_object = new(pool) linkout::CFileName())->AddReference();
76  break;
77  case e_Query:
78  case e_ObjId:
79  m_string.Construct();
80  break;
81  default:
82  break;
83  }
84  m_choice = index;
85 }
86 
87 const char* const CObjectList_Base::C_Data::sm_SelectionNames[] = {
88  "not set",
89  "FileName",
90  "Query",
91  "ObjId"
92 };
93 
95 {
96  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
97 }
98 
100 {
101  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
102 }
103 
105 {
106  CheckSelected(e_FileName);
107  return *static_cast<const TFileName*>(m_object);
108 }
109 
111 {
112  Select(e_FileName, NCBI_NS_NCBI::eDoNotResetVariant);
113  return *static_cast<TFileName*>(m_object);
114 }
115 
117 {
118  TFileName* ptr = &value;
119  if ( m_choice != e_FileName || m_object != ptr ) {
120  ResetSelection();
121  (m_object = ptr)->AddReference();
122  m_choice = e_FileName;
123  }
124 }
125 
127 {
128  Select(e_Query, NCBI_NS_NCBI::eDoNotResetVariant);
129  *m_string = value;
130 }
131 
133 {
134  Select(e_ObjId, NCBI_NS_NCBI::eDoNotResetVariant);
135  *m_string = value;
136 }
137 
138 // helper methods
139 
140 // type info
142 {
143  SET_INTERNAL_NAME("ObjectList", "E");
144  SET_CHOICE_MODULE("linkout");
145  ADD_NAMED_REF_CHOICE_VARIANT("FileName", m_object, CFileName)->SetNsQualified(true);
148  info->CodeVersion(22400);
149  info->DataSpec(ncbi::EDataSpec::eDTD);
150 }
152 
153 // constructor
155  : m_choice(e_not_set)
156 {
157 }
158 
159 // destructor
161 {
162  Reset();
163 }
164 
165 
166 void CObjectList_Base::Reset(void)
167 {
168  m_data.clear();
169  m_set_State[0] &= ~0x3;
170 }
171 
173 {
174  SET_CLASS_MODULE("linkout");
175  ADD_NAMED_MEMBER("", m_data, STL_list, (STL_CRef, (CLASS, (C_Data))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetNonEmpty();
176  info->RandomOrder();
177  info->CodeVersion(22400);
178  info->DataSpec(ncbi::EDataSpec::eDTD);
179 }
181 
182 // constructor
184 {
185  memset(m_set_State,0,sizeof(m_set_State));
186 }
187 
188 // destructor
190 {
191 }
192 
193 
194 
195 END_linkout_SCOPE // namespace linkout::
196 
#define BEGIN_linkout_SCOPE
Definition: Apad_.hpp:52
#define END_linkout_SCOPE
Definition: Apad_.hpp:53
User-defined methods of the data storage class.
CFileName –.
Definition: FileName.hpp:64
All Entrez databases may be configured to include LinkOut.
Definition: ObjectList_.hpp:95
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
Definition: object_list.hpp:63
string
Definition: cgiapp.hpp:690
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
#define MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:447
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:385
@ eDoNotResetVariant
Definition: serialbase.hpp:78
virtual void Reset(void)
Reset the whole object.
Definition: ObjectList_.cpp:55
virtual ~CObjectList_Base(void)
Definition: ObjectList_.cpp:78
Uint4 m_set_State[1]
TObjId & SetObjId(void)
Select the variant.
static const char *const sm_SelectionNames[]
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: ObjectList_.cpp:55
E_Choice
Choice variants.
TQuery & SetQuery(void)
Select the variant.
NCBI_NS_STD::string TQuery
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_Data > > m_data
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: ObjectList_.cpp:99
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: ObjectList_.cpp:71
const TFileName & GetFileName(void) const
Get the variant data.
TFileName & SetFileName(void)
Select the variant.
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: ObjectList_.cpp:94
NCBI_NS_STD::string TObjId
void Reset(void)
Reset the whole object.
Definition: ObjectList_.cpp:49
@ e_not_set
No variant selected.
@ e_not_set
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CObjectList_Base::C_Data)
BEGIN_NAMED_BASE_IMPLICIT_CLASS_INFO("ObjectList", CObjectList)
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define STD
Modified on Fri Sep 20 14:58:20 2024 by modify_doxy.py rev. 669887