BDE 4.39.x Production Release
Loading...
Searching...
No Matches
s_baltst_mysequencewithdecimalattribute.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewithdecimalattribute.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewithdecimalattribute.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHDECIMALATTRIBUTE
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHDECIMALATTRIBUTE
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewithdecimalattribute_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewithdecimalattribute s_baltst_mysequencewithdecimalattribute
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewithdecimalattribute
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewithdecimalattribute-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewithdecimalattribute-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_mysequencewithdecimalattribute
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 <bsl_iosfwd.h>
58#include <bsl_limits.h>
59
60
61
62namespace s_baltst { class MySequenceWithDecimalAttribute; }
63namespace s_baltst {
64
65 // ====================================
66 // class MySequenceWithDecimalAttribute
67 // ====================================
68
70
71 // INSTANCE DATA
72 bdlb::NullableValue<double> d_attribute1;
73
74 public:
75 // TYPES
76 enum {
78 };
79
80 enum {
82 };
83
84 enum {
86 };
87
88 // CONSTANTS
89 static const char CLASS_NAME[];
90
92
93 public:
94 // CLASS METHODS
95
96 /// Return attribute information for the attribute indicated by the
97 /// specified `id` if the attribute exists, and 0 otherwise.
99
100 /// Return attribute information for the attribute indicated by the
101 /// specified `name` of the specified `nameLength` if the attribute
102 /// exists, and 0 otherwise.
104 const char *name,
105 int nameLength);
106
107 // CREATORS
108
109 /// Create an object of type `MySequenceWithDecimalAttribute` having the
110 /// default value.
112
113
114 // MANIPULATORS
115
116 /// Reset this object to the default value (i.e., its value upon
117 /// default construction).
118 void reset();
119
120 /// Invoke the specified `manipulator` sequentially on the address of
121 /// each (modifiable) attribute of this object, supplying `manipulator`
122 /// with the corresponding attribute information structure until such
123 /// invocation returns a non-zero value. Return the value from the
124 /// last invocation of `manipulator` (i.e., the invocation that
125 /// terminated the sequence).
126 template <typename t_MANIPULATOR>
127 int manipulateAttributes(t_MANIPULATOR& manipulator);
128
129 /// Invoke the specified `manipulator` on the address of
130 /// the (modifiable) attribute indicated by the specified `id`,
131 /// supplying `manipulator` with the corresponding attribute
132 /// information structure. Return the value returned from the
133 /// invocation of `manipulator` if `id` identifies an attribute of this
134 /// class, and -1 otherwise.
135 template <typename t_MANIPULATOR>
136 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
137
138 /// Invoke the specified `manipulator` on the address of
139 /// the (modifiable) attribute indicated by the specified `name` of the
140 /// specified `nameLength`, supplying `manipulator` with the
141 /// corresponding attribute information structure. Return the value
142 /// returned from the invocation of `manipulator` if `name` identifies
143 /// an attribute of this class, and -1 otherwise.
144 template <typename t_MANIPULATOR>
145 int manipulateAttribute(t_MANIPULATOR& manipulator,
146 const char *name,
147 int nameLength);
148
149 /// Return a reference to the modifiable "Attribute1" attribute of this
150 /// object.
152
153 // ACCESSORS
154
155 /// Format this object to the specified output `stream` at the
156 /// optionally specified indentation `level` and return a reference to
157 /// the modifiable `stream`. If `level` is specified, optionally
158 /// specify `spacesPerLevel`, the number of spaces per indentation level
159 /// for this and all of its nested objects. Each line is indented by
160 /// the absolute value of `level * spacesPerLevel`. If `level` is
161 /// negative, suppress indentation of the first line. If
162 /// `spacesPerLevel` is negative, suppress line breaks and format the
163 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
164 ///
165 /// \note Note that a trailing newline is provided
166 /// in multiline mode only.
167 bsl::ostream& print(bsl::ostream& stream,
168 int level = 0,
169 int spacesPerLevel = 4) const;
170
171 /// Invoke the specified `accessor` sequentially on each
172 /// (non-modifiable) attribute of this object, supplying `accessor`
173 /// with the corresponding attribute information structure until such
174 /// invocation returns a non-zero value. Return the value from the
175 /// last invocation of `accessor` (i.e., the invocation that terminated
176 /// the sequence).
177 template <typename t_ACCESSOR>
178 int accessAttributes(t_ACCESSOR& accessor) const;
179
180 /// Invoke the specified `accessor` on the (non-modifiable) attribute
181 /// of this object indicated by the specified `id`, supplying `accessor`
182 /// with the corresponding attribute information structure. Return the
183 /// value returned from the invocation of `accessor` if `id` identifies
184 /// an attribute of this class, and -1 otherwise.
185 template <typename t_ACCESSOR>
186 int accessAttribute(t_ACCESSOR& accessor, int id) const;
187
188 /// Invoke the specified `accessor` on the (non-modifiable) attribute
189 /// of this object indicated by the specified `name` of the specified
190 /// `nameLength`, supplying `accessor` with the corresponding attribute
191 /// information structure. Return the value returned from the
192 /// invocation of `accessor` if `name` identifies an attribute of this
193 /// class, and -1 otherwise.
194 template <typename t_ACCESSOR>
195 int accessAttribute(t_ACCESSOR& accessor,
196 const char *name,
197 int nameLength) const;
198
199 /// Return a reference offering non-modifiable access to the
200 /// "Attribute1" attribute of this object.
202
203 // HIDDEN FRIENDS
204
205 /// Return `true` if the specified `lhs` and `rhs` attribute objects
206 /// have the same value, and `false` otherwise. Two attribute objects
207 /// have the same value if each respective attribute has the same value.
210 {
211 return lhs.attribute1() == rhs.attribute1();
212 }
213
214 /// Returns `!(lhs == rhs)`
217 {
218 return !(lhs == rhs);
219 }
220
221 /// Format the specified `rhs` to the specified output `stream` and
222 /// return a reference to the modifiable `stream`.
223 friend bsl::ostream& operator<<(
224 bsl::ostream& stream,
226 {
227 return rhs.print(stream, 0, -1);
228 }
229};
230
231} // close package namespace
232
233// TRAITS
234
236template <>
237struct bdlat_UsesDefaultValueFlag<s_baltst::MySequenceWithDecimalAttribute> : bsl::true_type {};
238
239// ============================================================================
240// INLINE DEFINITIONS
241// ============================================================================
242
243namespace s_baltst {
244
245 // ------------------------------------
246 // class MySequenceWithDecimalAttribute
247 // ------------------------------------
248
249// CLASS METHODS
250// MANIPULATORS
251template <typename t_MANIPULATOR>
253{
254 int ret;
255
256 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
257 if (ret) {
258 return ret;
259 }
260
261 return 0;
262}
263
264template <typename t_MANIPULATOR>
265int MySequenceWithDecimalAttribute::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
266{
267 enum { NOT_FOUND = -1 };
268
269 switch (id) {
271 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
272 }
273 default:
274 return NOT_FOUND;
275 }
276}
277
278template <typename t_MANIPULATOR>
280 t_MANIPULATOR& manipulator,
281 const char *name,
282 int nameLength)
283{
284 enum { NOT_FOUND = -1 };
285
286 const bdlat_AttributeInfo *attributeInfo =
287 lookupAttributeInfo(name, nameLength);
288 if (0 == attributeInfo) {
289 return NOT_FOUND;
290 }
291
292 return manipulateAttribute(manipulator, attributeInfo->d_id);
293}
294
295inline
300
301// ACCESSORS
302template <typename t_ACCESSOR>
304{
305 int ret;
306
307 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
308 if (ret) {
309 return ret;
310 }
311
312 return 0;
313}
314
315template <typename t_ACCESSOR>
316int MySequenceWithDecimalAttribute::accessAttribute(t_ACCESSOR& accessor, int id) const
317{
318 enum { NOT_FOUND = -1 };
319
320 switch (id) {
322 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
323 }
324 default:
325 return NOT_FOUND;
326 }
327}
328
329template <typename t_ACCESSOR>
331 t_ACCESSOR& accessor,
332 const char *name,
333 int nameLength) const
334{
335 enum { NOT_FOUND = -1 };
336
337 const bdlat_AttributeInfo *attributeInfo =
338 lookupAttributeInfo(name, nameLength);
339 if (0 == attributeInfo) {
340 return NOT_FOUND;
341 }
342
343 return accessAttribute(accessor, attributeInfo->d_id);
344}
345
346inline
348{
349 return d_attribute1;
350}
351
352} // close package namespace
353
354// FREE FUNCTIONS
355
356
357#endif
358
359// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
360// USING bas_codegen.pl s_baltst_mysequencewithdecimalattribute.xsd --mode msg --includedir . --msgComponent mysequencewithdecimalattribute --noRecurse --noExternalization --noHashSupport --noAggregateConversion
361// ----------------------------------------------------------------------------
362// NOTICE:
363// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
364// Property of Bloomberg Finance L.P. (BFLP)
365// This software is made available solely pursuant to the
366// terms of a BFLP license agreement which governs its use.
367// ------------------------------- END-OF-FILE --------------------------------
368
369/** @} */
370/** @} */
371/** @} */
Definition bdlb_nullablevalue.h:262
Definition s_baltst_mysequencewithdecimalattribute.h:69
bdlb::NullableValue< double > & attribute1()
Definition s_baltst_mysequencewithdecimalattribute.h:296
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithdecimalattribute.h:89
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithDecimalAttribute &rhs)
Definition s_baltst_mysequencewithdecimalattribute.h:223
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewithdecimalattribute.h:77
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithdecimalattribute.h:252
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewithdecimalattribute.h:85
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithdecimalattribute.h:265
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithdecimalattribute.h:81
friend bool operator!=(const MySequenceWithDecimalAttribute &lhs, const MySequenceWithDecimalAttribute &rhs)
Returns !(lhs == rhs)
Definition s_baltst_mysequencewithdecimalattribute.h:215
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithdecimalattribute.h:91
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
friend bool operator==(const MySequenceWithDecimalAttribute &lhs, const MySequenceWithDecimalAttribute &rhs)
Definition s_baltst_mysequencewithdecimalattribute.h:208
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithdecimalattribute.h:316
int accessAttributes(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithdecimalattribute.h:303
#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