BDE 4.39.x Production Release
Loading...
Searching...
No Matches
s_baltst_mysequencewiththreearrays.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewiththreearrays.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewiththreearrays.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHTHREEARRAYS
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHTHREEARRAYS
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewiththreearrays_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewiththreearrays s_baltst_mysequencewiththreearrays
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewiththreearrays
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewiththreearrays-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewiththreearrays-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_mysequencewiththreearrays
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 <bslma_default.h>
54
55#include <bsls_assert.h>
56
57#include <bsl_string.h>
58
59#include <bsl_vector.h>
60
61#include <bsl_iosfwd.h>
62#include <bsl_limits.h>
63
64
65
66namespace bslma { class Allocator; }
67
68namespace s_baltst { class MySequenceWithThreeArrays; }
69namespace s_baltst {
70
71 // ===============================
72 // class MySequenceWithThreeArrays
73 // ===============================
74
76
77 // INSTANCE DATA
78 bsl::vector<int> d_attribute2;
79 bsl::vector<double> d_attribute3;
80 bsl::vector<bsl::string> d_attribute1;
81
82 public:
83 // TYPES
84 enum {
88 };
89
90 enum {
92 };
93
94 enum {
98 };
99
100 // CONSTANTS
101 static const char CLASS_NAME[];
102
104
105 public:
106 // CLASS METHODS
107
108 /// Return attribute information for the attribute indicated by the
109 /// specified `id` if the attribute exists, and 0 otherwise.
111
112 /// Return attribute information for the attribute indicated by the
113 /// specified `name` of the specified `nameLength` if the attribute
114 /// exists, and 0 otherwise.
116 const char *name,
117 int nameLength);
118
119 // CREATORS
120
121 /// Create an object of type `MySequenceWithThreeArrays` having the
122 /// default value. Use the optionally specified `basicAllocator` to
123 /// supply memory. If `basicAllocator` is 0, the currently installed
124 /// default allocator is used.
125 explicit MySequenceWithThreeArrays(bslma::Allocator *basicAllocator = 0);
126
127 /// Create an object of type `MySequenceWithThreeArrays` having the
128 /// value of the specified `original` object. Use the optionally
129 /// specified `basicAllocator` to supply memory. If `basicAllocator` is
130 /// 0, the currently installed default allocator is used.
132 bslma::Allocator *basicAllocator = 0);
133
134#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
135 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
136 /// Create an object of type `MySequenceWithThreeArrays` having the
137 /// value of the specified `original` object. After performing this
138 /// action, the `original` object will be left in a valid, but
139 /// unspecified state.
141
142 /// Create an object of type `MySequenceWithThreeArrays` having the
143 /// value of the specified `original` object. After performing this
144 /// action, the `original` object will be left in a valid, but
145 /// unspecified state. Use the optionally specified `basicAllocator` to
146 /// supply memory. If `basicAllocator` is 0, the currently installed
147 /// default allocator is used.
149 bslma::Allocator *basicAllocator);
150#endif
151
152 /// Destroy this object.
154
155 // MANIPULATORS
156
157 /// Assign to this object the value of the specified `rhs` object.
159
160#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
161 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
162 /// Assign to this object the value of the specified `rhs` object.
163 /// After performing this action, the `rhs` object will be left in a
164 /// valid, but unspecified state.
166#endif
167
168 /// Reset this object to the default value (i.e., its value upon
169 /// default construction).
170 void reset();
171
172 /// Invoke the specified `manipulator` sequentially on the address of
173 /// each (modifiable) attribute of this object, supplying `manipulator`
174 /// with the corresponding attribute information structure until such
175 /// invocation returns a non-zero value. Return the value from the
176 /// last invocation of `manipulator` (i.e., the invocation that
177 /// terminated the sequence).
178 template <typename t_MANIPULATOR>
179 int manipulateAttributes(t_MANIPULATOR& manipulator);
180
181 /// Invoke the specified `manipulator` on the address of
182 /// the (modifiable) attribute indicated by the specified `id`,
183 /// supplying `manipulator` with the corresponding attribute
184 /// information structure. Return the value returned from the
185 /// invocation of `manipulator` if `id` identifies an attribute of this
186 /// class, and -1 otherwise.
187 template <typename t_MANIPULATOR>
188 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
189
190 /// Invoke the specified `manipulator` on the address of
191 /// the (modifiable) attribute indicated by the specified `name` of the
192 /// specified `nameLength`, supplying `manipulator` with the
193 /// corresponding attribute information structure. Return the value
194 /// returned from the invocation of `manipulator` if `name` identifies
195 /// an attribute of this class, and -1 otherwise.
196 template <typename t_MANIPULATOR>
197 int manipulateAttribute(t_MANIPULATOR& manipulator,
198 const char *name,
199 int nameLength);
200
201 /// Return a reference to the modifiable "Attribute1" attribute of this
202 /// object.
204
205 /// Return a reference to the modifiable "Attribute2" attribute of this
206 /// object.
208
209 /// Return a reference to the modifiable "Attribute3" attribute of this
210 /// object.
212
213 // ACCESSORS
214
215 /// Format this object to the specified output `stream` at the
216 /// optionally specified indentation `level` and return a reference to
217 /// the modifiable `stream`. If `level` is specified, optionally
218 /// specify `spacesPerLevel`, the number of spaces per indentation level
219 /// for this and all of its nested objects. Each line is indented by
220 /// the absolute value of `level * spacesPerLevel`. If `level` is
221 /// negative, suppress indentation of the first line. If
222 /// `spacesPerLevel` is negative, suppress line breaks and format the
223 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
224 ///
225 /// \note Note that a trailing newline is provided
226 /// in multiline mode only.
227 bsl::ostream& print(bsl::ostream& stream,
228 int level = 0,
229 int spacesPerLevel = 4) const;
230
231 /// Invoke the specified `accessor` sequentially on each
232 /// (non-modifiable) attribute of this object, supplying `accessor`
233 /// with the corresponding attribute information structure until such
234 /// invocation returns a non-zero value. Return the value from the
235 /// last invocation of `accessor` (i.e., the invocation that terminated
236 /// the sequence).
237 template <typename t_ACCESSOR>
238 int accessAttributes(t_ACCESSOR& accessor) const;
239
240 /// Invoke the specified `accessor` on the (non-modifiable) attribute
241 /// of this object indicated by the specified `id`, supplying `accessor`
242 /// with the corresponding attribute information structure. Return the
243 /// value returned from the invocation of `accessor` if `id` identifies
244 /// an attribute of this class, and -1 otherwise.
245 template <typename t_ACCESSOR>
246 int accessAttribute(t_ACCESSOR& accessor, int id) const;
247
248 /// Invoke the specified `accessor` on the (non-modifiable) attribute
249 /// of this object indicated by the specified `name` of the specified
250 /// `nameLength`, supplying `accessor` with the corresponding attribute
251 /// information structure. Return the value returned from the
252 /// invocation of `accessor` if `name` identifies an attribute of this
253 /// class, and -1 otherwise.
254 template <typename t_ACCESSOR>
255 int accessAttribute(t_ACCESSOR& accessor,
256 const char *name,
257 int nameLength) const;
258
259 /// Return a reference offering non-modifiable access to the
260 /// "Attribute1" attribute of this object.
262
263 /// Return a reference offering non-modifiable access to the
264 /// "Attribute2" attribute of this object.
265 const bsl::vector<int>& attribute2() const;
266
267 /// Return a reference offering non-modifiable access to the
268 /// "Attribute3" attribute of this object.
269 const bsl::vector<double>& attribute3() const;
270
271 // HIDDEN FRIENDS
272
273 /// Return `true` if the specified `lhs` and `rhs` attribute objects
274 /// have the same value, and `false` otherwise. Two attribute objects
275 /// have the same value if each respective attribute has the same value.
276 friend bool operator==(const MySequenceWithThreeArrays& lhs,
277 const MySequenceWithThreeArrays& rhs)
278 {
279 return lhs.attribute1() == rhs.attribute1() &&
280 lhs.attribute2() == rhs.attribute2() &&
281 lhs.attribute3() == rhs.attribute3();
282 }
283
284 /// Returns `!(lhs == rhs)`
285 friend bool operator!=(const MySequenceWithThreeArrays& lhs,
286 const MySequenceWithThreeArrays& rhs)
287 {
288 return !(lhs == rhs);
289 }
290
291 /// Format the specified `rhs` to the specified output `stream` and
292 /// return a reference to the modifiable `stream`.
293 friend bsl::ostream& operator<<(bsl::ostream& stream,
294 const MySequenceWithThreeArrays& rhs)
295 {
296 return rhs.print(stream, 0, -1);
297 }
298};
299
300} // close package namespace
301
302// TRAITS
303
305template <>
306struct bdlat_UsesDefaultValueFlag<s_baltst::MySequenceWithThreeArrays> : bsl::true_type {};
307
308// ============================================================================
309// INLINE DEFINITIONS
310// ============================================================================
311
312namespace s_baltst {
313
314 // -------------------------------
315 // class MySequenceWithThreeArrays
316 // -------------------------------
317
318// CLASS METHODS
319// MANIPULATORS
320template <typename t_MANIPULATOR>
322{
323 int ret;
324
325 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
326 if (ret) {
327 return ret;
328 }
329
330 ret = manipulator(&d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
331 if (ret) {
332 return ret;
333 }
334
335 ret = manipulator(&d_attribute3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE3]);
336 if (ret) {
337 return ret;
338 }
339
340 return 0;
341}
342
343template <typename t_MANIPULATOR>
344int MySequenceWithThreeArrays::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
345{
346 enum { NOT_FOUND = -1 };
347
348 switch (id) {
350 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
351 }
353 return manipulator(&d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
354 }
356 return manipulator(&d_attribute3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE3]);
357 }
358 default:
359 return NOT_FOUND;
360 }
361}
362
363template <typename t_MANIPULATOR>
365 t_MANIPULATOR& manipulator,
366 const char *name,
367 int nameLength)
368{
369 enum { NOT_FOUND = -1 };
370
371 const bdlat_AttributeInfo *attributeInfo =
372 lookupAttributeInfo(name, nameLength);
373 if (0 == attributeInfo) {
374 return NOT_FOUND;
375 }
376
377 return manipulateAttribute(manipulator, attributeInfo->d_id);
378}
379
380inline
385
386inline
388{
389 return d_attribute2;
390}
391
392inline
394{
395 return d_attribute3;
396}
397
398// ACCESSORS
399template <typename t_ACCESSOR>
400int MySequenceWithThreeArrays::accessAttributes(t_ACCESSOR& accessor) const
401{
402 int ret;
403
404 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
405 if (ret) {
406 return ret;
407 }
408
409 ret = accessor(d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
410 if (ret) {
411 return ret;
412 }
413
414 ret = accessor(d_attribute3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE3]);
415 if (ret) {
416 return ret;
417 }
418
419 return 0;
420}
421
422template <typename t_ACCESSOR>
423int MySequenceWithThreeArrays::accessAttribute(t_ACCESSOR& accessor, int id) const
424{
425 enum { NOT_FOUND = -1 };
426
427 switch (id) {
429 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
430 }
432 return accessor(d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
433 }
435 return accessor(d_attribute3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE3]);
436 }
437 default:
438 return NOT_FOUND;
439 }
440}
441
442template <typename t_ACCESSOR>
444 t_ACCESSOR& accessor,
445 const char *name,
446 int nameLength) const
447{
448 enum { NOT_FOUND = -1 };
449
450 const bdlat_AttributeInfo *attributeInfo =
451 lookupAttributeInfo(name, nameLength);
452 if (0 == attributeInfo) {
453 return NOT_FOUND;
454 }
455
456 return accessAttribute(accessor, attributeInfo->d_id);
457}
458
459inline
461{
462 return d_attribute1;
463}
464
465inline
467{
468 return d_attribute2;
469}
470
471inline
473{
474 return d_attribute3;
475}
476
477} // close package namespace
478
479// FREE FUNCTIONS
480
481
482#endif
483
484// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
485// USING bas_codegen.pl s_baltst_mysequencewiththreearrays.xsd --mode msg --includedir . --msgComponent mysequencewiththreearrays --noRecurse --noExternalization --noHashSupport --noAggregateConversion
486// ----------------------------------------------------------------------------
487// NOTICE:
488// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
489// Property of Bloomberg Finance L.P. (BFLP)
490// This software is made available solely pursuant to the
491// terms of a BFLP license agreement which governs its use.
492// ------------------------------- END-OF-FILE --------------------------------
493
494/** @} */
495/** @} */
496/** @} */
Definition bslstl_vector.h:1120
Definition bslma_allocator.h:545
Definition s_baltst_mysequencewiththreearrays.h:75
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
MySequenceWithThreeArrays(bslma::Allocator *basicAllocator=0)
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewiththreearrays.h:95
@ ATTRIBUTE_INDEX_ATTRIBUTE3
Definition s_baltst_mysequencewiththreearrays.h:97
@ ATTRIBUTE_INDEX_ATTRIBUTE2
Definition s_baltst_mysequencewiththreearrays.h:96
friend bool operator!=(const MySequenceWithThreeArrays &lhs, const MySequenceWithThreeArrays &rhs)
Returns !(lhs == rhs)
Definition s_baltst_mysequencewiththreearrays.h:285
MySequenceWithThreeArrays(const MySequenceWithThreeArrays &original, bslma::Allocator *basicAllocator=0)
static const char CLASS_NAME[]
Definition s_baltst_mysequencewiththreearrays.h:101
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewiththreearrays.h:344
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithThreeArrays &rhs)
Definition s_baltst_mysequencewiththreearrays.h:293
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
bsl::vector< int > & attribute2()
Definition s_baltst_mysequencewiththreearrays.h:387
~MySequenceWithThreeArrays()
Destroy this object.
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessAttributes(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewiththreearrays.h:400
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewiththreearrays.h:91
MySequenceWithThreeArrays & operator=(const MySequenceWithThreeArrays &rhs)
Assign to this object the value of the specified rhs object.
@ ATTRIBUTE_ID_ATTRIBUTE3
Definition s_baltst_mysequencewiththreearrays.h:87
@ ATTRIBUTE_ID_ATTRIBUTE2
Definition s_baltst_mysequencewiththreearrays.h:86
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewiththreearrays.h:85
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewiththreearrays.h:423
bsl::vector< double > & attribute3()
Definition s_baltst_mysequencewiththreearrays.h:393
bsl::vector< bsl::string > & attribute1()
Definition s_baltst_mysequencewiththreearrays.h:381
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewiththreearrays.h:103
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewiththreearrays.h:321
friend bool operator==(const MySequenceWithThreeArrays &lhs, const MySequenceWithThreeArrays &rhs)
Definition s_baltst_mysequencewiththreearrays.h:276
#define BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:301
#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 baljsn_encoder_testtypes.h:76
Definition s_baltst_address.h:66
Definition bdlat_attributeinfo.h:139
int d_id
Definition bdlat_attributeinfo.h:142
Definition bdlat_typetraits.h:146