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