BDE 4.39.x 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
116 // MANIPULATORS
117
118 /// Reset this object to the default value (i.e., its value upon
119 /// default construction).
120 void reset();
121
122 /// Invoke the specified `manipulator` sequentially on the address of
123 /// each (modifiable) attribute of this object, supplying `manipulator`
124 /// with the corresponding attribute information structure until such
125 /// invocation returns a non-zero value. Return the value from the
126 /// last invocation of `manipulator` (i.e., the invocation that
127 /// terminated the sequence).
128 template <typename t_MANIPULATOR>
129 int manipulateAttributes(t_MANIPULATOR& manipulator);
130
131 /// Invoke the specified `manipulator` on the address of
132 /// the (modifiable) attribute indicated by the specified `id`,
133 /// supplying `manipulator` with the corresponding attribute
134 /// information structure. Return the value returned from the
135 /// invocation of `manipulator` if `id` identifies an attribute of this
136 /// class, and -1 otherwise.
137 template <typename t_MANIPULATOR>
138 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
139
140 /// Invoke the specified `manipulator` on the address of
141 /// the (modifiable) attribute indicated by the specified `name` of the
142 /// specified `nameLength`, supplying `manipulator` with the
143 /// corresponding attribute information structure. Return the value
144 /// returned from the invocation of `manipulator` if `name` identifies
145 /// an attribute of this class, and -1 otherwise.
146 template <typename t_MANIPULATOR>
147 int manipulateAttribute(t_MANIPULATOR& manipulator,
148 const char *name,
149 int nameLength);
150
151 /// Return a reference to the modifiable "Attribute1" attribute of this
152 /// object.
154
155 // ACCESSORS
156
157 /// Format this object to the specified output `stream` at the
158 /// optionally specified indentation `level` and return a reference to
159 /// the modifiable `stream`. If `level` is specified, optionally
160 /// specify `spacesPerLevel`, the number of spaces per indentation level
161 /// for this and all of its nested objects. Each line is indented by
162 /// the absolute value of `level * spacesPerLevel`. If `level` is
163 /// negative, suppress indentation of the first line. If
164 /// `spacesPerLevel` is negative, suppress line breaks and format the
165 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
166 ///
167 /// \note Note that a trailing newline is provided
168 /// in multiline mode only.
169 bsl::ostream& print(bsl::ostream& stream,
170 int level = 0,
171 int spacesPerLevel = 4) const;
172
173 /// Invoke the specified `accessor` sequentially on each
174 /// (non-modifiable) attribute of this object, supplying `accessor`
175 /// with the corresponding attribute information structure until such
176 /// invocation returns a non-zero value. Return the value from the
177 /// last invocation of `accessor` (i.e., the invocation that terminated
178 /// the sequence).
179 template <typename t_ACCESSOR>
180 int accessAttributes(t_ACCESSOR& accessor) const;
181
182 /// Invoke the specified `accessor` on the (non-modifiable) attribute
183 /// of this object indicated by the specified `id`, supplying `accessor`
184 /// with the corresponding attribute information structure. Return the
185 /// value returned from the invocation of `accessor` if `id` identifies
186 /// an attribute of this class, and -1 otherwise.
187 template <typename t_ACCESSOR>
188 int accessAttribute(t_ACCESSOR& accessor, int id) const;
189
190 /// Invoke the specified `accessor` on the (non-modifiable) attribute
191 /// of this object indicated by the specified `name` of the specified
192 /// `nameLength`, supplying `accessor` with the corresponding attribute
193 /// information structure. Return the value returned from the
194 /// invocation of `accessor` if `name` identifies an attribute of this
195 /// class, and -1 otherwise.
196 template <typename t_ACCESSOR>
197 int accessAttribute(t_ACCESSOR& accessor,
198 const char *name,
199 int nameLength) const;
200
201 /// Return a reference offering non-modifiable access to the
202 /// "Attribute1" attribute of this object.
204
205 // HIDDEN FRIENDS
206
207 /// Return `true` if the specified `lhs` and `rhs` attribute objects
208 /// have the same value, and `false` otherwise. Two attribute objects
209 /// have the same value if each respective attribute has the same value.
212 {
213 return lhs.attribute1() == rhs.attribute1();
214 }
215
216 /// Returns `!(lhs == rhs)`
219 {
220 return !(lhs == rhs);
221 }
222
223 /// Format the specified `rhs` to the specified output `stream` and
224 /// return a reference to the modifiable `stream`.
225 friend bsl::ostream& operator<<(
226 bsl::ostream& stream,
228 {
229 return rhs.print(stream, 0, -1);
230 }
231};
232
233} // close package namespace
234
235// TRAITS
236
238template <>
239struct bdlat_UsesDefaultValueFlag<s_baltst::MySequenceWithPrecisionDecimalAttribute> : bsl::true_type {};
240
241// ============================================================================
242// INLINE DEFINITIONS
243// ============================================================================
244
245namespace s_baltst {
246
247 // ---------------------------------------------
248 // class MySequenceWithPrecisionDecimalAttribute
249 // ---------------------------------------------
250
251// CLASS METHODS
252// MANIPULATORS
253template <typename t_MANIPULATOR>
255{
256 int ret;
257
258 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
259 if (ret) {
260 return ret;
261 }
262
263 return 0;
264}
265
266template <typename t_MANIPULATOR>
268{
269 enum { NOT_FOUND = -1 };
270
271 switch (id) {
273 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
274 }
275 default:
276 return NOT_FOUND;
277 }
278}
279
280template <typename t_MANIPULATOR>
282 t_MANIPULATOR& manipulator,
283 const char *name,
284 int nameLength)
285{
286 enum { NOT_FOUND = -1 };
287
288 const bdlat_AttributeInfo *attributeInfo =
289 lookupAttributeInfo(name, nameLength);
290 if (0 == attributeInfo) {
291 return NOT_FOUND;
292 }
293
294 return manipulateAttribute(manipulator, attributeInfo->d_id);
295}
296
297inline
302
303// ACCESSORS
304template <typename t_ACCESSOR>
306{
307 int ret;
308
309 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
310 if (ret) {
311 return ret;
312 }
313
314 return 0;
315}
316
317template <typename t_ACCESSOR>
318int MySequenceWithPrecisionDecimalAttribute::accessAttribute(t_ACCESSOR& accessor, int id) const
319{
320 enum { NOT_FOUND = -1 };
321
322 switch (id) {
324 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
325 }
326 default:
327 return NOT_FOUND;
328 }
329}
330
331template <typename t_ACCESSOR>
333 t_ACCESSOR& accessor,
334 const char *name,
335 int nameLength) const
336{
337 enum { NOT_FOUND = -1 };
338
339 const bdlat_AttributeInfo *attributeInfo =
340 lookupAttributeInfo(name, nameLength);
341 if (0 == attributeInfo) {
342 return NOT_FOUND;
343 }
344
345 return accessAttribute(accessor, attributeInfo->d_id);
346}
347
348inline
353
354} // close package namespace
355
356// FREE FUNCTIONS
357
358
359#endif
360
361// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
362// USING bas_codegen.pl s_baltst_mysequencewithprecisiondecimalattribute.xsd --mode msg --includedir . --msgComponent mysequencewithprecisiondecimalattribute --noRecurse --noExternalization --noHashSupport --noAggregateConversion
363// ----------------------------------------------------------------------------
364// NOTICE:
365// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
366// Property of Bloomberg Finance L.P. (BFLP)
367// This software is made available solely pursuant to the
368// terms of a BFLP license agreement which governs its use.
369// ------------------------------- END-OF-FILE --------------------------------
370
371/** @} */
372/** @} */
373/** @} */
Definition bdlb_nullablevalue.h:262
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:71
int accessAttributes(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:305
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:83
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:87
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:91
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithPrecisionDecimalAttribute &rhs)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:225
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:318
bdlb::NullableValue< bdldfp::Decimal64 > & attribute1()
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:298
friend bool operator!=(const MySequenceWithPrecisionDecimalAttribute &lhs, const MySequenceWithPrecisionDecimalAttribute &rhs)
Returns !(lhs == rhs)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:217
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:93
friend bool operator==(const MySequenceWithPrecisionDecimalAttribute &lhs, const MySequenceWithPrecisionDecimalAttribute &rhs)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:210
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:267
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:79
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithprecisiondecimalattribute.h:254
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:294
#define BSLS_IDENT_RCSID(tag, str)
BSLS_IDENT_RCSID() - insert ident str (specific to platform/compiler)
Definition bsls_ident.h:244
#define BSLS_IDENT_PRAGMA_ONCE
BSLS_IDENT_PRAGMA_ONCE - macro to avoid multiple inclusion
Definition bsls_ident.h:263
Definition s_baltst_address.h:66
Definition bdlat_attributeinfo.h:139
int d_id
Definition bdlat_attributeinfo.h:142
Definition bdlat_typetraits.h:146