BDE 4.14.0 Production release
Loading...
Searching...
No Matches
s_baltst_mysequencewithprecisiondecimalattribute.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewithprecisiondecimalattribute.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewithprecisiondecimalattribute.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHPRECISIONDECIMALATTRIBUTE
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHPRECISIONDECIMALATTRIBUTE
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewithprecisiondecimalattribute_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewithprecisiondecimalattribute s_baltst_mysequencewithprecisiondecimalattribute
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewithprecisiondecimalattribute
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewithprecisiondecimalattribute-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewithprecisiondecimalattribute-purpose}
28/// Provide value-semantic attribute classes
29/// @}
30/** @} */
31/** @} */
32
33/** @addtogroup Standalones
34 * @{
35 */
36/** @addtogroup s_baltst
37 * @{
38 */
39/** @addtogroup s_baltst_mysequencewithprecisiondecimalattribute
40 * @{
41 */
42
43#include <bslalg_typetraits.h>
44
45#include <bdlat_attributeinfo.h>
46
47#include <bdlat_selectioninfo.h>
48
49#include <bdlat_typetraits.h>
50
51#include <bsls_objectbuffer.h>
52
53#include <bsls_assert.h>
54
55#include <bdlb_nullablevalue.h>
56
57#include <bdldfp_decimal.h>
58
59#include <bsl_iosfwd.h>
60#include <bsl_limits.h>
61
62
63
64namespace s_baltst { class MySequenceWithPrecisionDecimalAttribute; }
65namespace s_baltst {
66
67 // =============================================
68 // class MySequenceWithPrecisionDecimalAttribute
69 // =============================================
70
72
73 // INSTANCE DATA
75
76 public:
77 // TYPES
78 enum {
80 };
81
82 enum {
84 };
85
86 enum {
88 };
89
90 // CONSTANTS
91 static const char CLASS_NAME[];
92
94
95 public:
96 // CLASS METHODS
97
98 /// Return attribute information for the attribute indicated by the
99 /// specified `id` if the attribute exists, and 0 otherwise.
101
102 /// Return attribute information for the attribute indicated by the
103 /// specified `name` of the specified `nameLength` if the attribute
104 /// exists, and 0 otherwise.
106 const char *name,
107 int nameLength);
108
109 // CREATORS
110
111 /// Create an object of type `MySequenceWithPrecisionDecimalAttribute`
112 /// having the default value.
114
115 /// Create an object of type `MySequenceWithPrecisionDecimalAttribute`
116 /// having the value of the specified `original` object.
118
119#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
120 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
121 /// Create an object of type `MySequenceWithPrecisionDecimalAttribute`
122 /// having the value of the specified `original` object. After
123 /// performing this action, the `original` object will be left in a
124 /// valid, but unspecified state.
126#endif
127
128 /// Destroy this object.
130
131 // MANIPULATORS
132
133 /// Assign to this object the value of the specified `rhs` object.
135
136#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
137 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
138 /// Assign to this object the value of the specified `rhs` object.
139 /// After performing this action, the `rhs` object will be left in a
140 /// valid, but unspecified state.
142#endif
143
144 /// Reset this object to the default value (i.e., its value upon
145 /// default construction).
146 void reset();
147
148 /// Invoke the specified `manipulator` sequentially on the address of
149 /// each (modifiable) attribute of this object, supplying `manipulator`
150 /// with the corresponding attribute information structure until such
151 /// invocation returns a non-zero value. Return the value from the
152 /// last invocation of `manipulator` (i.e., the invocation that
153 /// terminated the sequence).
154 template<class MANIPULATOR>
155 int manipulateAttributes(MANIPULATOR& manipulator);
156
157 /// Invoke the specified `manipulator` on the address of
158 /// the (modifiable) attribute indicated by the specified `id`,
159 /// supplying `manipulator` with the corresponding attribute
160 /// information structure. Return the value returned from the
161 /// invocation of `manipulator` if `id` identifies an attribute of this
162 /// class, and -1 otherwise.
163 template<class MANIPULATOR>
164 int manipulateAttribute(MANIPULATOR& manipulator, int id);
165
166 /// Invoke the specified `manipulator` on the address of
167 /// the (modifiable) attribute indicated by the specified `name` of the
168 /// specified `nameLength`, supplying `manipulator` with the
169 /// corresponding attribute information structure. Return the value
170 /// returned from the invocation of `manipulator` if `name` identifies
171 /// an attribute of this class, and -1 otherwise.
172 template<class MANIPULATOR>
173 int manipulateAttribute(MANIPULATOR& manipulator,
174 const char *name,
175 int nameLength);
176
177 /// Return a reference to the modifiable "Attribute1" attribute of this
178 /// object.
180
181 // ACCESSORS
182
183 /// Format this object to the specified output `stream` at the
184 /// optionally specified indentation `level` and return a reference to
185 /// the modifiable `stream`. If `level` is specified, optionally
186 /// specify `spacesPerLevel`, the number of spaces per indentation level
187 /// for this and all of its nested objects. Each line is indented by
188 /// the absolute value of `level * spacesPerLevel`. If `level` is
189 /// negative, suppress indentation of the first line. If
190 /// `spacesPerLevel` is negative, suppress line breaks and format the
191 /// entire output on one line. If `stream` is initially invalid, this
192 /// operation has no effect. Note that a trailing newline is provided
193 /// in multiline mode only.
194 bsl::ostream& print(bsl::ostream& stream,
195 int level = 0,
196 int spacesPerLevel = 4) const;
197
198 /// Invoke the specified `accessor` sequentially on each
199 /// (non-modifiable) attribute of this object, supplying `accessor`
200 /// with the corresponding attribute information structure until such
201 /// invocation returns a non-zero value. Return the value from the
202 /// last invocation of `accessor` (i.e., the invocation that terminated
203 /// the sequence).
204 template<class ACCESSOR>
205 int accessAttributes(ACCESSOR& accessor) const;
206
207 /// Invoke the specified `accessor` on the (non-modifiable) attribute
208 /// of this object indicated by the specified `id`, supplying `accessor`
209 /// with the corresponding attribute information structure. Return the
210 /// value returned from the invocation of `accessor` if `id` identifies
211 /// an attribute of this class, and -1 otherwise.
212 template<class ACCESSOR>
213 int accessAttribute(ACCESSOR& accessor, int id) const;
214
215 /// Invoke the specified `accessor` on the (non-modifiable) attribute
216 /// of this object indicated by the specified `name` of the specified
217 /// `nameLength`, supplying `accessor` with the corresponding attribute
218 /// information structure. Return the value returned from the
219 /// invocation of `accessor` if `name` identifies an attribute of this
220 /// class, and -1 otherwise.
221 template<class ACCESSOR>
222 int accessAttribute(ACCESSOR& accessor,
223 const char *name,
224 int nameLength) const;
225
226 /// Return a reference offering non-modifiable access to the
227 /// "Attribute1" attribute of this object.
229};
230
231// FREE OPERATORS
232
233/// Return `true` if the specified `lhs` and `rhs` attribute objects have
234/// the same value, and `false` otherwise. Two attribute objects have the
235/// same value if each respective attribute has the same value.
236inline
238
239/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
240/// have the same value, and `false` otherwise. Two attribute objects do
241/// not have the same value if one or more respective attributes differ in
242/// values.
243inline
245
246/// Format the specified `rhs` to the specified output `stream` and
247/// return a reference to the modifiable `stream`.
248inline
249bsl::ostream& operator<<(bsl::ostream& stream, const MySequenceWithPrecisionDecimalAttribute& rhs);
250
251} // close package namespace
252
253// TRAITS
254
256
257// ============================================================================
258// INLINE FUNCTION DEFINITIONS
259// ============================================================================
260
261namespace s_baltst {
262
263 // ---------------------------------------------
264 // class MySequenceWithPrecisionDecimalAttribute
265 // ---------------------------------------------
266
267// CLASS METHODS
268// MANIPULATORS
269template <class MANIPULATOR>
271{
272 int ret;
273
274 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
275 if (ret) {
276 return ret;
277 }
278
279 return 0;
280}
281
282template <class MANIPULATOR>
284{
285 enum { NOT_FOUND = -1 };
286
287 switch (id) {
289 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
290 }
291 default:
292 return NOT_FOUND;
293 }
294}
295
296template <class MANIPULATOR>
298 MANIPULATOR& manipulator,
299 const char *name,
300 int nameLength)
301{
302 enum { NOT_FOUND = -1 };
303
304 const bdlat_AttributeInfo *attributeInfo =
305 lookupAttributeInfo(name, nameLength);
306 if (0 == attributeInfo) {
307 return NOT_FOUND;
308 }
309
310 return manipulateAttribute(manipulator, attributeInfo->d_id);
311}
312
313inline
318
319// ACCESSORS
320template <class ACCESSOR>
322{
323 int ret;
324
325 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
326 if (ret) {
327 return ret;
328 }
329
330 return 0;
331}
332
333template <class ACCESSOR>
335{
336 enum { NOT_FOUND = -1 };
337
338 switch (id) {
340 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
341 }
342 default:
343 return NOT_FOUND;
344 }
345}
346
347template <class ACCESSOR>
349 ACCESSOR& accessor,
350 const char *name,
351 int nameLength) const
352{
353 enum { NOT_FOUND = -1 };
354
355 const bdlat_AttributeInfo *attributeInfo =
356 lookupAttributeInfo(name, nameLength);
357 if (0 == attributeInfo) {
358 return NOT_FOUND;
359 }
360
361 return accessAttribute(accessor, attributeInfo->d_id);
362}
363
364inline
369
370} // close package namespace
371
372// FREE FUNCTIONS
373
374inline
378{
379 return lhs.attribute1() == rhs.attribute1();
380}
381
382inline
386{
387 return !(lhs == rhs);
388}
389
390inline
391bsl::ostream& s_baltst::operator<<(
392 bsl::ostream& stream,
394{
395 return rhs.print(stream, 0, -1);
396}
397
398
399#endif
400
401// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
402// USING bas_codegen.pl s_baltst_mysequencewithprecisiondecimalattribute.xsd --mode msg --includedir . --msgComponent mysequencewithprecisiondecimalattribute --noRecurse --noExternalization --noHashSupport --noAggregateConversion
403// ----------------------------------------------------------------------------
404// NOTICE:
405// Copyright 2022 Bloomberg Finance L.P. All rights reserved.
406// Property of Bloomberg Finance L.P. (BFLP)
407// This software is made available solely pursuant to the
408// terms of a BFLP license agreement which governs its use.
409// ------------------------------- END-OF-FILE --------------------------------
410
411/** @} */
412/** @} */
413/** @} */
Definition bdlb_nullablevalue.h:257
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:71
int manipulateAttributes(MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:270
int manipulateAttribute(MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:283
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:91
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:79
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:83
bdlb::NullableValue< bdldfp::Decimal64 > & attribute1()
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:314
int accessAttribute(ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:334
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:93
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
~MySequenceWithPrecisionDecimalAttribute()
Destroy this object.
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:87
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
MySequenceWithPrecisionDecimalAttribute(const MySequenceWithPrecisionDecimalAttribute &original)
int accessAttributes(ACCESSOR &accessor) const
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:321
MySequenceWithPrecisionDecimalAttribute & operator=(const MySequenceWithPrecisionDecimalAttribute &rhs)
Assign to this object the value of the specified rhs object.
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:275
#define BSLS_IDENT_RCSID(tag, str)
Definition bsls_ident.h:260
#define BSLS_IDENT_PRAGMA_ONCE
Definition bsls_ident.h:310
Definition s_baltst_address.h:66
bool operator!=(const Address &lhs, const Address &rhs)
bool operator==(const Address &lhs, const Address &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const Address &rhs)
Definition bdlat_attributeinfo.h:137
int d_id
Definition bdlat_attributeinfo.h:140