NCBI C++ ToolKit
SubObjectSelector_.hpp
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  */
27 
28 /// @file SubObjectSelector_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/eutils/linkout/linkout.dtd">linkout.dtd</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/eutils/linkout/linkout.def">linkout.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef linkout__OBJTOOLS_EUTILS_LINKOUT_SUBOBJECTSELECTOR_BASE_HPP
42 #define linkout__OBJTOOLS_EUTILS_LINKOUT_SUBOBJECTSELECTOR_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
50 #ifndef BEGIN_linkout_SCOPE
51 # define BEGIN_linkout_SCOPE BEGIN_SCOPE(linkout)
52 # define END_linkout_SCOPE END_SCOPE(linkout)
53 #endif
54 BEGIN_linkout_SCOPE // namespace linkout::
55 
56 
57 // forward declarations
58 class CSubProvider;
59 
60 
61 // generated classes
62 
63 
64 /** @addtogroup dataspec_linkout
65  *
66  * @{
67  */
68 
69 /////////////////////////////////////////////////////////////////////////////
70 /// End of ObjectList group
71 /// End of ObjectSelector group
72 /// Libraries must use SubObjectSelector to refer to the sub providers
73 ///
74 /// CSubObjectSelector_Base --
75 ///
76 
77 class NCBI_EUTILS_EXPORT CSubObjectSelector_Base : public NCBI_NS_NCBI::CSerialObject
78 {
79  typedef NCBI_NS_NCBI::CSerialObject Tparent;
80 public:
81  // constructor
83  // destructor
84  virtual ~CSubObjectSelector_Base(void);
85 
86  // type info
88 
89  // types
92 
93  // member index
94  enum class E_memberIndex {
95  e__allMandatory = 0,
96  e_Database,
97  e_SubProvider
98  };
99  typedef Tparent::CMemberIndex<E_memberIndex, 3> TmemberIndex;
100 
101  // getters
102  // setters
103 
104  /// Check if a value has been assigned to Database data member.
105  ///
106  /// Data member Database is mandatory;
107  /// its type is defined as 'typedef NCBI_NS_STD::string TDatabase'
108  /// @return
109  /// - true, if a value has been assigned.
110  /// - false, otherwise.
111  bool IsSetDatabase(void) const;
112 
113  /// Check if it is safe to call GetDatabase method.
114  ///
115  /// @return
116  /// - true, if the data member is getatable.
117  /// - false, otherwise.
118  bool CanGetDatabase(void) const;
119 
120  /// Reset Database data member.
121  void ResetDatabase(void);
122 
123  /// Get the Database member data.
124  ///
125  /// @return
126  /// Reference to the member data.
127  const TDatabase& GetDatabase(void) const;
128 
129  /// Assign a value to Database data member.
130  ///
131  /// @param value
132  /// Value to assign
133  void SetDatabase(const TDatabase& value);
134  void SetDatabase(TDatabase&& value);
135 
136  /// Assign a value to Database data member.
137  ///
138  /// @return
139  /// Reference to the data value.
140  TDatabase& SetDatabase(void);
141 
142  /// Check if a value has been assigned to SubProvider data member.
143  ///
144  /// Data member SubProvider is mandatory;
145  /// its type is defined as 'typedef CSubProvider TSubProvider'
146  /// @return
147  /// - true, if a value has been assigned.
148  /// - false, otherwise.
149  bool IsSetSubProvider(void) const;
150 
151  /// Check if it is safe to call GetSubProvider method.
152  ///
153  /// @return
154  /// - true, if the data member is getatable.
155  /// - false, otherwise.
156  bool CanGetSubProvider(void) const;
157 
158  /// Reset SubProvider data member.
159  void ResetSubProvider(void);
160 
161  /// Get the SubProvider member data.
162  ///
163  /// @return
164  /// Reference to the member data.
165  const TSubProvider& GetSubProvider(void) const;
166 
167  /// Assign a value to SubProvider data member.
168  ///
169  /// @param value
170  /// Reference to value.
171  void SetSubProvider(TSubProvider& value);
172 
173  /// Assign a value to SubProvider data member.
174  ///
175  /// @return
176  /// Reference to the data value.
177  TSubProvider& SetSubProvider(void);
178 
179  /// Reset the whole object
180  virtual void Reset(void);
181 
182 
183 private:
184  // Prohibit copy constructor and assignment operator
187 
188  // data
189  Uint4 m_set_State[1];
191  NCBI_NS_NCBI::CRef< TSubProvider > m_SubProvider;
192 };
193 
194 /* @} */
195 
196 
197 
198 
199 
200 ///////////////////////////////////////////////////////////
201 ///////////////////// inline methods //////////////////////
202 ///////////////////////////////////////////////////////////
203 inline
205 {
206  return ((m_set_State[0] & 0x3) != 0);
207 }
208 
209 inline
211 {
212  return IsSetDatabase();
213 }
214 
215 inline
217 {
218  if (!CanGetDatabase()) {
219  ThrowUnassigned(0);
220  }
221  return m_Database;
222 }
223 
224 inline
226 {
227  m_Database = value;
228  m_set_State[0] |= 0x3;
229 }
230 
231 inline
233 {
234  m_Database = std::forward<CSubObjectSelector_Base::TDatabase>(value);
235  m_set_State[0] |= 0x3;
236 }
237 
238 inline
240 {
241 #ifdef _DEBUG
242  if (!IsSetDatabase()) {
243  m_Database = UnassignedString();
244  }
245 #endif
246  m_set_State[0] |= 0x1;
247  return m_Database;
248 }
249 
250 inline
252 {
253  return m_SubProvider.NotEmpty();
254 }
255 
256 inline
258 {
259  return true;
260 }
261 
262 inline
264 {
265  if ( !m_SubProvider ) {
266  const_cast<CSubObjectSelector_Base*>(this)->ResetSubProvider();
267  }
268  return (*m_SubProvider);
269 }
270 
271 inline
273 {
274  if ( !m_SubProvider ) {
276  }
277  return (*m_SubProvider);
278 }
279 
280 ///////////////////////////////////////////////////////////
281 ////////////////// end of inline methods //////////////////
282 ///////////////////////////////////////////////////////////
283 
284 
285 
286 
287 
288 END_linkout_SCOPE // namespace linkout::
289 
290 
291 #endif // linkout__OBJTOOLS_EUTILS_LINKOUT_SUBOBJECTSELECTOR_BASE_HPP
#define BEGIN_linkout_SCOPE
#define END_linkout_SCOPE
End of ObjectList group End of ObjectSelector group Libraries must use SubObjectSelector to refer to ...
CSubProvider –.
Definition: SubProvider.hpp:64
string
Definition: cgiapp.hpp:690
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define NCBI_EUTILS_EXPORT
Definition: ncbi_export.h:1460
void ResetSubProvider(void)
Reset SubProvider data member.
bool IsSetSubProvider(void) const
Check if a value has been assigned to SubProvider data member.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
CSubObjectSelector_Base(const CSubObjectSelector_Base &)
CSubObjectSelector_Base & operator=(const CSubObjectSelector_Base &)
NCBI_NS_STD::string m_Database
bool CanGetDatabase(void) const
Check if it is safe to call GetDatabase method.
NCBI_NS_NCBI::CSerialObject Tparent
bool IsSetDatabase(void) const
Check if a value has been assigned to Database data member.
bool CanGetSubProvider(void) const
Check if it is safe to call GetSubProvider method.
TSubProvider & SetSubProvider(void)
Assign a value to SubProvider data member.
NCBI_NS_NCBI::CRef< TSubProvider > m_SubProvider
const TSubProvider & GetSubProvider(void) const
Get the SubProvider member data.
const TDatabase & GetDatabase(void) const
Get the Database member data.
TDatabase & SetDatabase(void)
Assign a value to Database data member.
NCBI_NS_STD::string TDatabase
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:29 2024 by modify_doxy.py rev. 669887