NCBI C++ ToolKit
TMgr_Attribute_.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 TMgr_Attribute_.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/trackmgr/trackmgr.asn">trackmgr.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/trackmgr/trackmgr.def">trackmgr.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_TRACKMGR_TMGR_ATTRIBUTE_BASE_HPP
42 #define OBJECTS_TRACKMGR_TMGR_ATTRIBUTE_BASE_HPP
43 
44 // extra headers
46 
47 // standard includes
48 #include <serial/serialbase.hpp>
49 
50 // generated includes
51 #include <string>
52 
54 
55 #ifndef BEGIN_objects_SCOPE
56 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
57 # define END_objects_SCOPE END_SCOPE(objects)
58 #endif
59 BEGIN_objects_SCOPE // namespace ncbi::objects::
60 
61 
62 // generated classes
63 
64 
65 /** @addtogroup dataspec_NCBI_TrackManager
66  *
67  * @{
68  */
69 
70 /////////////////////////////////////////////////////////////////////////////
71 ///
72 /// CTMgr_Attribute_Base --
73 ///
74 
76 {
78 public:
79  // constructor
81  // destructor
82  virtual ~CTMgr_Attribute_Base(void);
83 
84  // type info
86 
87  // types
88  typedef string TKey;
90 
91  // member index
92  enum class E_memberIndex {
93  e__allMandatory = 0,
94  e_key,
95  e_value
96  };
98 
99  // getters
100  // setters
101 
102  /// Check if a value has been assigned to Key data member.
103  ///
104  /// Data member Key is mandatory;
105  /// its type is defined as 'typedef string TKey'
106  /// @return
107  /// - true, if a value has been assigned.
108  /// - false, otherwise.
109  bool IsSetKey(void) const;
110 
111  /// Check if it is safe to call GetKey method.
112  ///
113  /// @return
114  /// - true, if the data member is getatable.
115  /// - false, otherwise.
116  bool CanGetKey(void) const;
117 
118  /// Reset Key data member.
119  void ResetKey(void);
120 
121  /// Get the Key member data.
122  ///
123  /// @return
124  /// Reference to the member data.
125  const TKey& GetKey(void) const;
126 
127  /// Assign a value to Key data member.
128  ///
129  /// @param value
130  /// Value to assign
131  void SetKey(const TKey& value);
132  void SetKey(TKey&& value);
133 
134  /// Assign a value to Key data member.
135  ///
136  /// @return
137  /// Reference to the data value.
138  TKey& SetKey(void);
139 
140  /// Check if a value has been assigned to Value data member.
141  ///
142  /// Data member Value is mandatory;
143  /// its type is defined as 'typedef CStringUTF8 TValue'
144  /// @return
145  /// - true, if a value has been assigned.
146  /// - false, otherwise.
147  bool IsSetValue(void) const;
148 
149  /// Check if it is safe to call GetValue method.
150  ///
151  /// @return
152  /// - true, if the data member is getatable.
153  /// - false, otherwise.
154  bool CanGetValue(void) const;
155 
156  /// Reset Value data member.
157  void ResetValue(void);
158 
159  /// Get the Value member data.
160  ///
161  /// @return
162  /// Reference to the member data.
163  const TValue& GetValue(void) const;
164 
165  /// Assign a value to Value data member.
166  ///
167  /// @param value
168  /// Value to assign
169  void SetValue(const TValue& value);
170  void SetValue(TValue&& value);
171 
172  /// Assign a value to Value data member.
173  ///
174  /// @return
175  /// Reference to the data value.
176  TValue& SetValue(void);
177 
178  /// Reset the whole object
179  virtual void Reset(void);
180 
181 
182 private:
183  // Prohibit copy constructor and assignment operator
186 
187  // data
188  Uint4 m_set_State[1];
189  string m_Key;
191 };
192 
193 /* @} */
194 
195 
196 
197 
198 
199 ///////////////////////////////////////////////////////////
200 ///////////////////// inline methods //////////////////////
201 ///////////////////////////////////////////////////////////
202 inline
204 {
205  return ((m_set_State[0] & 0x3) != 0);
206 }
207 
208 inline
210 {
211  return IsSetKey();
212 }
213 
214 inline
216 {
217  if (!CanGetKey()) {
218  ThrowUnassigned(0);
219  }
220  return m_Key;
221 }
222 
223 inline
225 {
226  m_Key = value;
227  m_set_State[0] |= 0x3;
228 }
229 
230 inline
232 {
233  m_Key = std::forward<CTMgr_Attribute_Base::TKey>(value);
234  m_set_State[0] |= 0x3;
235 }
236 
237 inline
239 {
240 #ifdef _DEBUG
241  if (!IsSetKey()) {
243  }
244 #endif
245  m_set_State[0] |= 0x1;
246  return m_Key;
247 }
248 
249 inline
251 {
252  return ((m_set_State[0] & 0xc) != 0);
253 }
254 
255 inline
257 {
258  return IsSetValue();
259 }
260 
261 inline
263 {
264  if (!CanGetValue()) {
265  ThrowUnassigned(1);
266  }
267  return m_Value;
268 }
269 
270 inline
272 {
273  m_Value = value;
274  m_set_State[0] |= 0xc;
275 }
276 
277 inline
279 {
280  m_Value = std::forward<CTMgr_Attribute_Base::TValue>(value);
281  m_set_State[0] |= 0xc;
282 }
283 
284 inline
286 {
287 #ifdef _DEBUG
288  if (!IsSetValue()) {
290  }
291 #endif
292  m_set_State[0] |= 0x4;
293  return m_Value;
294 }
295 
296 ///////////////////////////////////////////////////////////
297 ////////////////// end of inline methods //////////////////
298 ///////////////////////////////////////////////////////////
299 
300 
301 
302 
303 
304 END_objects_SCOPE // namespace ncbi::objects::
305 
307 
308 
309 #endif // OBJECTS_TRACKMGR_TMGR_ATTRIBUTE_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTMgr_Attribute_Base –.
static CStringUTF8 UnassignedStringUTF8(void)
Definition: serialbase.hpp:178
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
std::string CStringUTF8
Definition: ncbistl.hpp:254
CTMgr_Attribute_Base & operator=(const CTMgr_Attribute_Base &)
const TKey & GetKey(void) const
Get the Key member data.
bool CanGetKey(void) const
Check if it is safe to call GetKey method.
const TValue & GetValue(void) const
Get the Value member data.
bool IsSetValue(void) const
Check if a value has been assigned to Value data member.
TKey & SetKey(void)
Assign a value to Key data member.
CTMgr_Attribute_Base(const CTMgr_Attribute_Base &)
TValue & SetValue(void)
Assign a value to Value data member.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
bool IsSetKey(void) const
Check if a value has been assigned to Key data member.
bool CanGetValue(void) const
Check if it is safe to call GetValue method.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Defines to provide correct exporting from DLLs in Windows.
#define NCBI_TRACKMGR_EXPORT
Modified on Wed May 22 11:31:12 2024 by modify_doxy.py rev. 669887