NCBI C++ ToolKit
RefSource_.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 RefSource_.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/efetch/efetch.xsd">efetch.xsd</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/eutils/efetch/efetch.def">efetch.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 eutils__OBJTOOLS_EUTILS_EFETCH_REFSOURCE_BASE_HPP
42 #define eutils__OBJTOOLS_EUTILS_EFETCH_REFSOURCE_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
50 #ifndef BEGIN_eutils_SCOPE
51 # define BEGIN_eutils_SCOPE BEGIN_SCOPE(eutils)
52 # define END_eutils_SCOPE END_SCOPE(eutils)
53 #endif
54 BEGIN_eutils_SCOPE // namespace eutils::
55 
56 
57 // generated classes
58 
59 
60 /** @addtogroup dataspec_efetch
61  *
62  * @{
63  */
64 
65 /////////////////////////////////////////////////////////////////////////////
66 ///
67 /// CRefSource_Base --
68 ///
69 
70 class CRefSource_Base : public NCBI_NS_NCBI::CSerialObject
71 {
72  typedef NCBI_NS_NCBI::CSerialObject Tparent;
73 public:
74  // constructor
75  CRefSource_Base(void);
76  // destructor
77  virtual ~CRefSource_Base(void);
78 
79  // type info
81 
82  // types
84 
85  /// Constructor from the primitive type
86  CRefSource_Base(const Tdata& value);
87  /// Assignment operator.
88  void operator=(const Tdata& value);
89 
90  // getters
91  // setters
92 
93  /// Check if a value has been assigned to data member.
94  ///
95  /// Data member is mandatory;
96  /// its type is defined as 'typedef NCBI_NS_STD::string Tdata'
97  /// @return
98  /// - true, if a value has been assigned.
99  /// - false, otherwise.
100  bool IsSet(void) const;
101 
102  /// Check if it is safe to call Get method.
103  ///
104  /// @return
105  /// - true, if the data member is getatable.
106  /// - false, otherwise.
107  bool CanGet(void) const;
108 
109  /// Reset data member.
110  void Reset(void);
111 
112  /// Get the member data.
113  ///
114  /// @return
115  /// Reference to the member data.
116  const Tdata& Get(void) const;
117 
118  /// Assign a value to data member.
119  ///
120  /// @param value
121  /// Value to assign
122  void Set(const Tdata& value);
123  void Set(Tdata&& value);
124 
125  /// Assign a value to data member.
126  ///
127  /// @return
128  /// Reference to the data value.
129  Tdata& Set(void);
130 
131  /// Conversion operator to 'const Tdata' type.
132  operator const Tdata& (void) const;
133  /// Conversion operator to 'Tdata' type.
134  operator Tdata& (void);
135 
136 
137 
138 private:
139  // Prohibit copy constructor and assignment operator
142 
143  // data
146 };
147 
148 /* @} */
149 
150 
151 
152 
153 
154 ///////////////////////////////////////////////////////////
155 ///////////////////// inline methods //////////////////////
156 ///////////////////////////////////////////////////////////
157 inline
159 {
160  Set(value);
161 }
162 
163 inline
165 {
166  Set(value);
167 }
168 
169 inline
170 bool CRefSource_Base::IsSet(void) const
171 {
172  return ((m_set_State[0] & 0x3) != 0);
173 }
174 
175 inline
176 bool CRefSource_Base::CanGet(void) const
177 {
178  return IsSet();
179 }
180 
181 inline
183 {
184  if (!CanGet()) {
185  ThrowUnassigned(0);
186  }
187  return m_data;
188 }
189 
190 inline
192 {
193  m_data = value;
194  m_set_State[0] |= 0x3;
195 }
196 
197 inline
199 {
200  m_data = std::forward<CRefSource_Base::Tdata>(value);
201  m_set_State[0] |= 0x3;
202 }
203 
204 inline
206 {
207 #ifdef _DEBUG
208  if (!IsSet()) {
209  m_data = UnassignedString();
210  }
211 #endif
212  m_set_State[0] |= 0x1;
213  return m_data;
214 }
215 
216 inline
217 CRefSource_Base::operator const CRefSource_Base::Tdata& (void) const
218 {
219  return m_data;
220 }
221 
222 inline
223 CRefSource_Base::operator CRefSource_Base::Tdata& (void)
224 {
225 #ifdef _DEBUG
226  if (!IsSet()) {
227  m_data = UnassignedString();
228  }
229 #endif
230  m_set_State[0] |= 0x1;
231  return m_data;
232 }
233 
234 ///////////////////////////////////////////////////////////
235 ////////////////// end of inline methods //////////////////
236 ///////////////////////////////////////////////////////////
237 
238 
239 
240 
241 
242 END_eutils_SCOPE // namespace eutils::
243 
244 
245 #endif // eutils__OBJTOOLS_EUTILS_EFETCH_REFSOURCE_BASE_HPP
#define BEGIN_eutils_SCOPE
Definition: RefSource_.hpp:51
#define END_eutils_SCOPE
Definition: RefSource_.hpp:52
CRefSource_Base –.
Definition: RefSource_.hpp:71
string
Definition: cgiapp.hpp:690
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
void Reset(void)
Reset data member.
Definition: RefSource_.cpp:48
bool CanGet(void) const
Check if it is safe to call Get method.
Definition: RefSource_.hpp:176
CRefSource_Base & operator=(const CRefSource_Base &)
virtual ~CRefSource_Base(void)
Definition: RefSource_.cpp:72
NCBI_NS_NCBI::CSerialObject Tparent
Definition: RefSource_.hpp:72
const Tdata & Get(void) const
Get the member data.
Definition: RefSource_.hpp:182
CRefSource_Base(const CRefSource_Base &)
void operator=(const Tdata &value)
Assignment operator.
Definition: RefSource_.hpp:164
NCBI_NS_STD::string Tdata
Definition: RefSource_.hpp:83
NCBI_NS_STD::string m_data
Definition: RefSource_.hpp:145
bool IsSet(void) const
Check if a value has been assigned to data member.
Definition: RefSource_.hpp:170
Tdata & Set(void)
Assign a value to data member.
Definition: RefSource_.hpp:205
Uint4 m_set_State[1]
Definition: RefSource_.hpp:144
CRefSource_Base(void)
Definition: RefSource_.cpp:66
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:58:26 2024 by modify_doxy.py rev. 669887