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