NCBI C++ ToolKit
User_object_.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 User_object_.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/objects/general/general.asn">general.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/general/general.def">general.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 OBJECTS_GENERAL_USER_OBJECT_BASE_HPP
42 #define OBJECTS_GENERAL_USER_OBJECT_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 #include <vector>
50 
52 
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
56 #endif
57 BEGIN_objects_SCOPE // namespace ncbi::objects::
58 
59 
60 // forward declarations
61 class CObject_id;
62 class CUser_field;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_General
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 ///**** User-object **********************************************
75 ///*
76 ///* a general object for a user defined structured data item
77 ///* used by Seq-feat and Seq-descr
78 ///
79 /// CUser_object_Base --
80 ///
81 
83 {
85 public:
86  // constructor
87  CUser_object_Base(void);
88  // destructor
89  virtual ~CUser_object_Base(void);
90 
91  // type info
93 
94  // types
95  typedef string TClass;
96  typedef CObject_id TType;
97  typedef vector< CRef< CUser_field > > TData;
98 
99  // member index
100  enum class E_memberIndex {
101  e__allMandatory = 0,
102  e_class,
103  e_type,
104  e_data
105  };
107 
108  // getters
109  // setters
110 
111  /// endeavor which designed this object
112  /// Check if a value has been assigned to Class data member.
113  ///
114  /// Data member Class is optional;
115  /// its type is defined as 'typedef string TClass'
116  /// @return
117  /// - true, if a value has been assigned.
118  /// - false, otherwise.
119  bool IsSetClass(void) const;
120 
121  /// Check if it is safe to call GetClass method.
122  ///
123  /// @return
124  /// - true, if the data member is getatable.
125  /// - false, otherwise.
126  bool CanGetClass(void) const;
127 
128  /// Reset Class data member.
129  void ResetClass(void);
130 
131  /// Get the Class member data.
132  ///
133  /// @return
134  /// Reference to the member data.
135  const TClass& GetClass(void) const;
136 
137  /// Assign a value to Class data member.
138  ///
139  /// @param value
140  /// Value to assign
141  void SetClass(const TClass& value);
142  void SetClass(TClass&& value);
143 
144  /// Assign a value to Class data member.
145  ///
146  /// @return
147  /// Reference to the data value.
148  TClass& SetClass(void);
149 
150  /// type of object within class
151  /// Check if a value has been assigned to Type data member.
152  ///
153  /// Data member Type is mandatory;
154  /// its type is defined as 'typedef CObject_id TType'
155  /// @return
156  /// - true, if a value has been assigned.
157  /// - false, otherwise.
158  bool IsSetType(void) const;
159 
160  /// Check if it is safe to call GetType method.
161  ///
162  /// @return
163  /// - true, if the data member is getatable.
164  /// - false, otherwise.
165  bool CanGetType(void) const;
166 
167  /// Reset Type data member.
168  void ResetType(void);
169 
170  /// Get the Type member data.
171  ///
172  /// @return
173  /// Reference to the member data.
174  const TType& GetType(void) const;
175 
176  /// Assign a value to Type data member.
177  ///
178  /// @param value
179  /// Reference to value.
180  void SetType(TType& value);
181 
182  /// Assign a value to Type data member.
183  ///
184  /// @return
185  /// Reference to the data value.
186  TType& SetType(void);
187 
188  /// the object itself
189  /// Check if a value has been assigned to Data data member.
190  ///
191  /// Data member Data is mandatory;
192  /// its type is defined as 'typedef vector< CRef< CUser_field > > TData'
193  /// @return
194  /// - true, if a value has been assigned.
195  /// - false, otherwise.
196  bool IsSetData(void) const;
197 
198  /// Check if it is safe to call GetData method.
199  ///
200  /// @return
201  /// - true, if the data member is getatable.
202  /// - false, otherwise.
203  bool CanGetData(void) const;
204 
205  /// Reset Data data member.
206  void ResetData(void);
207 
208  /// Get the Data member data.
209  ///
210  /// @return
211  /// Reference to the member data.
212  const TData& GetData(void) const;
213 
214  /// Assign a value to Data data member.
215  ///
216  /// @return
217  /// Reference to the data value.
218  TData& SetData(void);
219 
220  /// Reset the whole object
221  virtual void Reset(void);
222 
223 
224 private:
225  // Prohibit copy constructor and assignment operator
228 
229  // data
230  Uint4 m_set_State[1];
231  string m_Class;
233  vector< CRef< CUser_field > > m_Data;
234 };
235 
236 /* @} */
237 
238 
239 
240 
241 
242 ///////////////////////////////////////////////////////////
243 ///////////////////// inline methods //////////////////////
244 ///////////////////////////////////////////////////////////
245 inline
247 {
248  return ((m_set_State[0] & 0x3) != 0);
249 }
250 
251 inline
253 {
254  return IsSetClass();
255 }
256 
257 inline
259 {
260  if (!CanGetClass()) {
261  ThrowUnassigned(0);
262  }
263  return m_Class;
264 }
265 
266 inline
268 {
269  m_Class = value;
270  m_set_State[0] |= 0x3;
271 }
272 
273 inline
275 {
276  m_Class = std::forward<CUser_object_Base::TClass>(value);
277  m_set_State[0] |= 0x3;
278 }
279 
280 inline
282 {
283 #ifdef _DEBUG
284  if (!IsSetClass()) {
286  }
287 #endif
288  m_set_State[0] |= 0x1;
289  return m_Class;
290 }
291 
292 inline
294 {
295  return m_Type.NotEmpty();
296 }
297 
298 inline
300 {
301  return true;
302 }
303 
304 inline
306 {
307  if ( !m_Type ) {
308  const_cast<CUser_object_Base*>(this)->ResetType();
309  }
310  return (*m_Type);
311 }
312 
313 inline
315 {
316  if ( !m_Type ) {
317  ResetType();
318  }
319  return (*m_Type);
320 }
321 
322 inline
324 {
325  return ((m_set_State[0] & 0x30) != 0);
326 }
327 
328 inline
330 {
331  return true;
332 }
333 
334 inline
336 {
337  return m_Data;
338 }
339 
340 inline
342 {
343  m_set_State[0] |= 0x10;
344  return m_Data;
345 }
346 
347 ///////////////////////////////////////////////////////////
348 ////////////////// end of inline methods //////////////////
349 ///////////////////////////////////////////////////////////
350 
351 
352 
353 
354 
355 END_objects_SCOPE // namespace ncbi::objects::
356 
358 
359 
360 #endif // OBJECTS_GENERAL_USER_OBJECT_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
**** User-object ********************************************** * * a general object for a user defin...
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GENERAL_EXPORT
Definition: ncbi_export.h:512
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
bool CanGetType(void) const
Check if it is safe to call GetType method.
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
bool CanGetClass(void) const
Check if it is safe to call GetClass method.
bool CanGetData(void) const
Check if it is safe to call GetData method.
TClass & SetClass(void)
Assign a value to Class data member.
CSerialObject Tparent
bool IsSetClass(void) const
endeavor which designed this object Check if a value has been assigned to Class data member.
CUser_object_Base(const CUser_object_Base &)
const TClass & GetClass(void) const
Get the Class member data.
TType & SetType(void)
Assign a value to Type data member.
TData & SetData(void)
Assign a value to Data data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
CRef< TType > m_Type
const TData & GetData(void) const
Get the Data member data.
CUser_object_Base & operator=(const CUser_object_Base &)
vector< CRef< CUser_field > > m_Data
void ResetType(void)
Reset Type data member.
const TType & GetType(void) const
Get the Type member data.
vector< CRef< CUser_field > > TData
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Apr 17 13:10:49 2024 by modify_doxy.py rev. 669887