BDE 4.39.x Production Release
Loading...
Searching...
No Matches
s_baltst_mysequencewithchoices.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewithchoices.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewithchoices.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHCHOICES
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHCHOICES
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewithchoices_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewithchoices s_baltst_mysequencewithchoices
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewithchoices
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewithchoices-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewithchoices-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_mysequencewithchoices
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 <bsl_iosfwd.h>
56#include <bsl_limits.h>
57
58
59
60namespace s_baltst { class MySequenceWithChoicesChoice1; }
61namespace s_baltst { class MySequenceWithChoicesChoice2; }
62namespace s_baltst { class MySequenceWithChoices; }
63namespace s_baltst {
64
65 // ==================================
66 // class MySequenceWithChoicesChoice1
67 // ==================================
68
70
71 // INSTANCE DATA
72 union {
75 };
76
77 int d_selectionId;
78
79 // PRIVATE ACCESSORS
80 bool isEqualTo(const MySequenceWithChoicesChoice1& rhs) const;
81
82 public:
83 // TYPES
84
85 enum {
89 };
90
91 enum {
93 };
94
95 enum {
98 };
99
100 // CONSTANTS
101 static const char CLASS_NAME[];
102
104
105 // CLASS METHODS
106
107 /// Return selection information for the selection indicated by the
108 /// specified `id` if the selection exists, and 0 otherwise.
110
111 /// Return selection information for the selection indicated by the
112 /// specified `name` of the specified `nameLength` if the selection
113 /// exists, and 0 otherwise.
115 const char *name,
116 int nameLength);
117
118 // CREATORS
119
120 /// Create an object of type `MySequenceWithChoicesChoice1` having the
121 /// default value.
123
124 /// Create an object of type `MySequenceWithChoicesChoice1` having the
125 /// value of the specified `original` object.
127
128#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
129 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
130 /// Create an object of type `MySequenceWithChoicesChoice1` having the
131 /// value of the specified `original` object. After performing this
132 /// action, the `original` object will be left in a valid, but
133 /// unspecified state.
135#endif
136
137 /// Destroy this object.
139
140 // MANIPULATORS
141
142 /// Assign to this object the value of the specified `rhs` object.
144
145#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
146 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
147 /// Assign to this object the value of the specified `rhs` object.
148 /// After performing this action, the `rhs` object will be left in a
149 /// valid, but unspecified state.
151#endif
152
153 /// Reset this object to the default value (i.e., its value upon default
154 /// construction).
155 void reset();
156
157 /// Set the value of this object to be the default for the selection
158 /// indicated by the specified `selectionId`. Return 0 on success, and
159 /// non-zero value otherwise (i.e., the selection is not found).
161
162 /// Set the value of this object to be the default for the selection
163 /// indicated by the specified `name` of the specified `nameLength`.
164 /// Return 0 on success, and non-zero value otherwise (i.e., the
165 /// selection is not found).
166 int makeSelection(const char *name, int nameLength);
167
168 /// Set the value of this object to be a "ChoiceA" value. Optionally
169 /// specify the `value` of the "ChoiceA". If `value` is not specified,
170 /// the default "ChoiceA" value is used.
172 int& makeChoiceA(int value);
173
174 /// Set the value of this object to be a "ChoiceB" value. Optionally
175 /// specify the `value` of the "ChoiceB". If `value` is not specified,
176 /// the default "ChoiceB" value is used.
178 int& makeChoiceB(int value);
179
180 /// Invoke the specified `manipulator` on the address of the modifiable
181 /// selection, supplying `manipulator` with the corresponding selection
182 /// information structure. Return the value returned from the
183 /// invocation of `manipulator` if this object has a defined selection,
184 /// and -1 otherwise.
185 template <typename t_MANIPULATOR>
186 int manipulateSelection(t_MANIPULATOR& manipulator);
187
188 /// Return a reference to the modifiable "ChoiceA" selection of this
189 /// object if "ChoiceA" is the current selection.
190 ///
191 /// \pre The behavior is undefined unless "ChoiceA" is the selection of this object.
192 int& choiceA();
193
194 /// Return a reference to the modifiable "ChoiceB" selection of this
195 /// object if "ChoiceB" is the current selection.
196 ///
197 /// \pre The behavior is undefined unless "ChoiceB" is the selection of this object.
198 int& choiceB();
199
200 // ACCESSORS
201
202 /// Format this object to the specified output `stream` at the
203 /// optionally specified indentation `level` and return a reference to
204 /// the modifiable `stream`. If `level` is specified, optionally
205 /// specify `spacesPerLevel`, the number of spaces per indentation level
206 /// for this and all of its nested objects. Each line is indented by
207 /// the absolute value of `level * spacesPerLevel`. If `level` is
208 /// negative, suppress indentation of the first line. If
209 /// `spacesPerLevel` is negative, suppress line breaks and format the
210 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
211 ///
212 /// \note Note that a trailing newline is provided
213 /// in multiline mode only.
214 bsl::ostream& print(bsl::ostream& stream,
215 int level = 0,
216 int spacesPerLevel = 4) const;
217
218 /// Return the id of the current selection if the selection is defined,
219 /// and -1 otherwise.
220 int selectionId() const;
221
222 /// Invoke the specified `accessor` on the non-modifiable selection,
223 /// supplying `accessor` with the corresponding selection information
224 /// structure. Return the value returned from the invocation of
225 /// `accessor` if this object has a defined selection, and -1 otherwise.
226 template <typename t_ACCESSOR>
227 int accessSelection(t_ACCESSOR& accessor) const;
228
229 /// Return a reference to the non-modifiable "ChoiceA" selection of this
230 /// object if "ChoiceA" is the current selection.
231 ///
232 /// \pre The behavior is undefined unless "ChoiceA" is the selection of this object.
233 const int& choiceA() const;
234
235 /// Return a reference to the non-modifiable "ChoiceB" selection of this
236 /// object if "ChoiceB" is the current selection.
237 ///
238 /// \pre The behavior is undefined unless "ChoiceB" is the selection of this object.
239 const int& choiceB() const;
240
241 /// Return `true` if the value of this object is a "ChoiceA" value, and
242 /// return `false` otherwise.
243 bool isChoiceAValue() const;
244
245 /// Return `true` if the value of this object is a "ChoiceB" value, and
246 /// return `false` otherwise.
247 bool isChoiceBValue() const;
248
249 /// Return `true` if the value of this object is undefined, and `false`
250 /// otherwise.
251 bool isUndefinedValue() const;
252
253 /// Return the symbolic name of the current selection of this object.
254 const char *selectionName() const;
255
256 // HIDDEN FRIENDS
257
258 /// Return `true` if the specified `lhs` and `rhs` objects have the same
259 /// value, and `false` otherwise. Two `MySequenceWithChoicesChoice1`
260 /// objects have the same value if either the selections in both objects
261 /// have the same ids and the same values, or both selections are
262 /// undefined.
265 {
266 return lhs.isEqualTo(rhs);
267 }
268
269 /// Return `true` if the specified `lhs` and `rhs` objects do not have
270 /// the same values, as determined by `operator==`, and `false`
271 /// otherwise.
274 {
275 return !(lhs == rhs);
276 }
277
278 /// Format the specified `rhs` to the specified output `stream` and
279 /// return a reference to the modifiable `stream`.
280 friend bsl::ostream& operator<<(bsl::ostream& stream,
282 {
283 return rhs.print(stream, 0, -1);
284 }
285};
286
287} // close package namespace
288
289// TRAITS
290
292
293namespace s_baltst {
294
295 // ==================================
296 // class MySequenceWithChoicesChoice2
297 // ==================================
298
300
301 // INSTANCE DATA
302 union {
305 };
306
307 int d_selectionId;
308
309 // PRIVATE ACCESSORS
310 bool isEqualTo(const MySequenceWithChoicesChoice2& rhs) const;
311
312 public:
313 // TYPES
314
315 enum {
319 };
320
321 enum {
323 };
324
325 enum {
328 };
329
330 // CONSTANTS
331 static const char CLASS_NAME[];
332
334
335 // CLASS METHODS
336
337 /// Return selection information for the selection indicated by the
338 /// specified `id` if the selection exists, and 0 otherwise.
340
341 /// Return selection information for the selection indicated by the
342 /// specified `name` of the specified `nameLength` if the selection
343 /// exists, and 0 otherwise.
345 const char *name,
346 int nameLength);
347
348 // CREATORS
349
350 /// Create an object of type `MySequenceWithChoicesChoice2` having the
351 /// default value.
353
354 /// Create an object of type `MySequenceWithChoicesChoice2` having the
355 /// value of the specified `original` object.
357
358#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
359 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
360 /// Create an object of type `MySequenceWithChoicesChoice2` having the
361 /// value of the specified `original` object. After performing this
362 /// action, the `original` object will be left in a valid, but
363 /// unspecified state.
365#endif
366
367 /// Destroy this object.
369
370 // MANIPULATORS
371
372 /// Assign to this object the value of the specified `rhs` object.
374
375#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
376 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
377 /// Assign to this object the value of the specified `rhs` object.
378 /// After performing this action, the `rhs` object will be left in a
379 /// valid, but unspecified state.
381#endif
382
383 /// Reset this object to the default value (i.e., its value upon default
384 /// construction).
385 void reset();
386
387 /// Set the value of this object to be the default for the selection
388 /// indicated by the specified `selectionId`. Return 0 on success, and
389 /// non-zero value otherwise (i.e., the selection is not found).
391
392 /// Set the value of this object to be the default for the selection
393 /// indicated by the specified `name` of the specified `nameLength`.
394 /// Return 0 on success, and non-zero value otherwise (i.e., the
395 /// selection is not found).
396 int makeSelection(const char *name, int nameLength);
397
398 /// Set the value of this object to be a "ChoiceC" value. Optionally
399 /// specify the `value` of the "ChoiceC". If `value` is not specified,
400 /// the default "ChoiceC" value is used.
402 int& makeChoiceC(int value);
403
404 /// Set the value of this object to be a "ChoiceD" value. Optionally
405 /// specify the `value` of the "ChoiceD". If `value` is not specified,
406 /// the default "ChoiceD" value is used.
408 int& makeChoiceD(int value);
409
410 /// Invoke the specified `manipulator` on the address of the modifiable
411 /// selection, supplying `manipulator` with the corresponding selection
412 /// information structure. Return the value returned from the
413 /// invocation of `manipulator` if this object has a defined selection,
414 /// and -1 otherwise.
415 template <typename t_MANIPULATOR>
416 int manipulateSelection(t_MANIPULATOR& manipulator);
417
418 /// Return a reference to the modifiable "ChoiceC" selection of this
419 /// object if "ChoiceC" is the current selection.
420 ///
421 /// \pre The behavior is undefined unless "ChoiceC" is the selection of this object.
422 int& choiceC();
423
424 /// Return a reference to the modifiable "ChoiceD" selection of this
425 /// object if "ChoiceD" is the current selection.
426 ///
427 /// \pre The behavior is undefined unless "ChoiceD" is the selection of this object.
428 int& choiceD();
429
430 // ACCESSORS
431
432 /// Format this object to the specified output `stream` at the
433 /// optionally specified indentation `level` and return a reference to
434 /// the modifiable `stream`. If `level` is specified, optionally
435 /// specify `spacesPerLevel`, the number of spaces per indentation level
436 /// for this and all of its nested objects. Each line is indented by
437 /// the absolute value of `level * spacesPerLevel`. If `level` is
438 /// negative, suppress indentation of the first line. If
439 /// `spacesPerLevel` is negative, suppress line breaks and format the
440 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
441 ///
442 /// \note Note that a trailing newline is provided
443 /// in multiline mode only.
444 bsl::ostream& print(bsl::ostream& stream,
445 int level = 0,
446 int spacesPerLevel = 4) const;
447
448 /// Return the id of the current selection if the selection is defined,
449 /// and -1 otherwise.
450 int selectionId() const;
451
452 /// Invoke the specified `accessor` on the non-modifiable selection,
453 /// supplying `accessor` with the corresponding selection information
454 /// structure. Return the value returned from the invocation of
455 /// `accessor` if this object has a defined selection, and -1 otherwise.
456 template <typename t_ACCESSOR>
457 int accessSelection(t_ACCESSOR& accessor) const;
458
459 /// Return a reference to the non-modifiable "ChoiceC" selection of this
460 /// object if "ChoiceC" is the current selection.
461 ///
462 /// \pre The behavior is undefined unless "ChoiceC" is the selection of this object.
463 const int& choiceC() const;
464
465 /// Return a reference to the non-modifiable "ChoiceD" selection of this
466 /// object if "ChoiceD" is the current selection.
467 ///
468 /// \pre The behavior is undefined unless "ChoiceD" is the selection of this object.
469 const int& choiceD() const;
470
471 /// Return `true` if the value of this object is a "ChoiceC" value, and
472 /// return `false` otherwise.
473 bool isChoiceCValue() const;
474
475 /// Return `true` if the value of this object is a "ChoiceD" value, and
476 /// return `false` otherwise.
477 bool isChoiceDValue() const;
478
479 /// Return `true` if the value of this object is undefined, and `false`
480 /// otherwise.
481 bool isUndefinedValue() const;
482
483 /// Return the symbolic name of the current selection of this object.
484 const char *selectionName() const;
485
486 // HIDDEN FRIENDS
487
488 /// Return `true` if the specified `lhs` and `rhs` objects have the same
489 /// value, and `false` otherwise. Two `MySequenceWithChoicesChoice2`
490 /// objects have the same value if either the selections in both objects
491 /// have the same ids and the same values, or both selections are
492 /// undefined.
495 {
496 return lhs.isEqualTo(rhs);
497 }
498
499 /// Return `true` if the specified `lhs` and `rhs` objects do not have
500 /// the same values, as determined by `operator==`, and `false`
501 /// otherwise.
504 {
505 return !(lhs == rhs);
506 }
507
508 /// Format the specified `rhs` to the specified output `stream` and
509 /// return a reference to the modifiable `stream`.
510 friend bsl::ostream& operator<<(bsl::ostream& stream,
512 {
513 return rhs.print(stream, 0, -1);
514 }
515};
516
517} // close package namespace
518
519// TRAITS
520
522
523namespace s_baltst {
524
525 // ===========================
526 // class MySequenceWithChoices
527 // ===========================
528
530
531 // INSTANCE DATA
534
535 public:
536 // TYPES
537 enum {
540 };
541
542 enum {
544 };
545
546 enum {
549 };
550
551 // CONSTANTS
552 static const char CLASS_NAME[];
553
555
556 public:
557 // CLASS METHODS
558
559 /// Return attribute information for the attribute indicated by the
560 /// specified `id` if the attribute exists, and 0 otherwise.
562
563 /// Return attribute information for the attribute indicated by the
564 /// specified `name` of the specified `nameLength` if the attribute
565 /// exists, and 0 otherwise.
567 const char *name,
568 int nameLength);
569
570 // CREATORS
571
572 /// Create an object of type `MySequenceWithChoices` having the default
573 /// value.
575
576
577 // MANIPULATORS
578
579 /// Reset this object to the default value (i.e., its value upon
580 /// default construction).
581 void reset();
582
583 /// Invoke the specified `manipulator` sequentially on the address of
584 /// each (modifiable) attribute of this object, supplying `manipulator`
585 /// with the corresponding attribute information structure until such
586 /// invocation returns a non-zero value. Return the value from the
587 /// last invocation of `manipulator` (i.e., the invocation that
588 /// terminated the sequence).
589 template <typename t_MANIPULATOR>
590 int manipulateAttributes(t_MANIPULATOR& manipulator);
591
592 /// Invoke the specified `manipulator` on the address of
593 /// the (modifiable) attribute indicated by the specified `id`,
594 /// supplying `manipulator` with the corresponding attribute
595 /// information structure. Return the value returned from the
596 /// invocation of `manipulator` if `id` identifies an attribute of this
597 /// class, and -1 otherwise.
598 template <typename t_MANIPULATOR>
599 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
600
601 /// Invoke the specified `manipulator` on the address of
602 /// the (modifiable) attribute indicated by the specified `name` of the
603 /// specified `nameLength`, supplying `manipulator` with the
604 /// corresponding attribute information structure. Return the value
605 /// returned from the invocation of `manipulator` if `name` identifies
606 /// an attribute of this class, and -1 otherwise.
607 template <typename t_MANIPULATOR>
608 int manipulateAttribute(t_MANIPULATOR& manipulator,
609 const char *name,
610 int nameLength);
611
612 /// Return a reference to the modifiable "First" attribute of this
613 /// object.
615
616 /// Return a reference to the modifiable "Second" attribute of this
617 /// object.
619
620 // ACCESSORS
621
622 /// Format this object to the specified output `stream` at the
623 /// optionally specified indentation `level` and return a reference to
624 /// the modifiable `stream`. If `level` is specified, optionally
625 /// specify `spacesPerLevel`, the number of spaces per indentation level
626 /// for this and all of its nested objects. Each line is indented by
627 /// the absolute value of `level * spacesPerLevel`. If `level` is
628 /// negative, suppress indentation of the first line. If
629 /// `spacesPerLevel` is negative, suppress line breaks and format the
630 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
631 ///
632 /// \note Note that a trailing newline is provided
633 /// in multiline mode only.
634 bsl::ostream& print(bsl::ostream& stream,
635 int level = 0,
636 int spacesPerLevel = 4) const;
637
638 /// Invoke the specified `accessor` sequentially on each
639 /// (non-modifiable) attribute of this object, supplying `accessor`
640 /// with the corresponding attribute information structure until such
641 /// invocation returns a non-zero value. Return the value from the
642 /// last invocation of `accessor` (i.e., the invocation that terminated
643 /// the sequence).
644 template <typename t_ACCESSOR>
645 int accessAttributes(t_ACCESSOR& accessor) const;
646
647 /// Invoke the specified `accessor` on the (non-modifiable) attribute
648 /// of this object indicated by the specified `id`, supplying `accessor`
649 /// with the corresponding attribute information structure. Return the
650 /// value returned from the invocation of `accessor` if `id` identifies
651 /// an attribute of this class, and -1 otherwise.
652 template <typename t_ACCESSOR>
653 int accessAttribute(t_ACCESSOR& accessor, int id) const;
654
655 /// Invoke the specified `accessor` on the (non-modifiable) attribute
656 /// of this object indicated by the specified `name` of the specified
657 /// `nameLength`, supplying `accessor` with the corresponding attribute
658 /// information structure. Return the value returned from the
659 /// invocation of `accessor` if `name` identifies an attribute of this
660 /// class, and -1 otherwise.
661 template <typename t_ACCESSOR>
662 int accessAttribute(t_ACCESSOR& accessor,
663 const char *name,
664 int nameLength) const;
665
666 /// Return a reference offering non-modifiable access to the "First"
667 /// attribute of this object.
668 const MySequenceWithChoicesChoice1& first() const;
669
670 /// Return a reference offering non-modifiable access to the "Second"
671 /// attribute of this object.
673
674 // HIDDEN FRIENDS
675
676 /// Return `true` if the specified `lhs` and `rhs` attribute objects
677 /// have the same value, and `false` otherwise. Two attribute objects
678 /// have the same value if each respective attribute has the same value.
679 friend bool operator==(const MySequenceWithChoices& lhs,
680 const MySequenceWithChoices& rhs)
681 {
682 return lhs.first() == rhs.first() &&
683 lhs.second() == rhs.second();
684 }
685
686 /// Returns `!(lhs == rhs)`
687 friend bool operator!=(const MySequenceWithChoices& lhs,
688 const MySequenceWithChoices& rhs)
689 {
690 return !(lhs == rhs);
691 }
692
693 /// Format the specified `rhs` to the specified output `stream` and
694 /// return a reference to the modifiable `stream`.
695 friend bsl::ostream& operator<<(bsl::ostream& stream,
696 const MySequenceWithChoices& rhs)
697 {
698 return rhs.print(stream, 0, -1);
699 }
700};
701
702} // close package namespace
703
704// TRAITS
705
707template <>
708struct bdlat_UsesDefaultValueFlag<s_baltst::MySequenceWithChoices> : bsl::true_type {};
709
710// ============================================================================
711// INLINE DEFINITIONS
712// ============================================================================
713
714namespace s_baltst {
715
716 // ----------------------------------
717 // class MySequenceWithChoicesChoice1
718 // ----------------------------------
719
720// CLASS METHODS
721// PRIVATE ACCESSORS
722inline
723bool MySequenceWithChoicesChoice1::isEqualTo(const MySequenceWithChoicesChoice1& rhs) const
724{
725 typedef MySequenceWithChoicesChoice1 Class;
726 if (this->selectionId() == rhs.selectionId()) {
727 switch (rhs.selectionId()) {
728 case Class::SELECTION_ID_CHOICE_A:
729 return this->choiceA() == rhs.choiceA();
730 case Class::SELECTION_ID_CHOICE_B:
731 return this->choiceB() == rhs.choiceB();
732 default:
733 BSLS_ASSERT(Class::SELECTION_ID_UNDEFINED == rhs.selectionId());
734 return true;
735 }
736 }
737 else {
738 return false;
739 }
740}
741
742// CREATORS
743inline
745: d_selectionId(SELECTION_ID_UNDEFINED)
746{
747}
748
749inline
754
755// MANIPULATORS
756template <typename t_MANIPULATOR>
758{
759 switch (d_selectionId) {
761 return manipulator(&d_choiceA.object(),
764 return manipulator(&d_choiceB.object(),
766 default:
768 return -1;
769 }
770}
771
772inline
774{
775 BSLS_ASSERT(SELECTION_ID_CHOICE_A == d_selectionId);
776 return d_choiceA.object();
777}
778
779inline
781{
782 BSLS_ASSERT(SELECTION_ID_CHOICE_B == d_selectionId);
783 return d_choiceB.object();
784}
785
786// ACCESSORS
787inline
789{
790 return d_selectionId;
791}
792
793template <typename t_ACCESSOR>
795{
796 switch (d_selectionId) {
798 return accessor(d_choiceA.object(),
801 return accessor(d_choiceB.object(),
803 default:
804 BSLS_ASSERT(SELECTION_ID_UNDEFINED == d_selectionId);
805 return -1;
806 }
807}
808
809inline
811{
812 BSLS_ASSERT(SELECTION_ID_CHOICE_A == d_selectionId);
813 return d_choiceA.object();
814}
815
816inline
818{
819 BSLS_ASSERT(SELECTION_ID_CHOICE_B == d_selectionId);
820 return d_choiceB.object();
821}
822
823inline
825{
826 return SELECTION_ID_CHOICE_A == d_selectionId;
827}
828
829inline
831{
832 return SELECTION_ID_CHOICE_B == d_selectionId;
833}
834
835inline
837{
838 return SELECTION_ID_UNDEFINED == d_selectionId;
839}
840
841
842 // ----------------------------------
843 // class MySequenceWithChoicesChoice2
844 // ----------------------------------
845
846// CLASS METHODS
847// PRIVATE ACCESSORS
848inline
849bool MySequenceWithChoicesChoice2::isEqualTo(const MySequenceWithChoicesChoice2& rhs) const
850{
851 typedef MySequenceWithChoicesChoice2 Class;
852 if (this->selectionId() == rhs.selectionId()) {
853 switch (rhs.selectionId()) {
854 case Class::SELECTION_ID_CHOICE_C:
855 return this->choiceC() == rhs.choiceC();
856 case Class::SELECTION_ID_CHOICE_D:
857 return this->choiceD() == rhs.choiceD();
858 default:
859 BSLS_ASSERT(Class::SELECTION_ID_UNDEFINED == rhs.selectionId());
860 return true;
861 }
862 }
863 else {
864 return false;
865 }
866}
867
868// CREATORS
869inline
871: d_selectionId(SELECTION_ID_UNDEFINED)
872{
873}
874
875inline
880
881// MANIPULATORS
882template <typename t_MANIPULATOR>
884{
885 switch (d_selectionId) {
887 return manipulator(&d_choiceC.object(),
890 return manipulator(&d_choiceD.object(),
892 default:
894 return -1;
895 }
896}
897
898inline
900{
901 BSLS_ASSERT(SELECTION_ID_CHOICE_C == d_selectionId);
902 return d_choiceC.object();
903}
904
905inline
907{
908 BSLS_ASSERT(SELECTION_ID_CHOICE_D == d_selectionId);
909 return d_choiceD.object();
910}
911
912// ACCESSORS
913inline
915{
916 return d_selectionId;
917}
918
919template <typename t_ACCESSOR>
921{
922 switch (d_selectionId) {
924 return accessor(d_choiceC.object(),
927 return accessor(d_choiceD.object(),
929 default:
930 BSLS_ASSERT(SELECTION_ID_UNDEFINED == d_selectionId);
931 return -1;
932 }
933}
934
935inline
937{
938 BSLS_ASSERT(SELECTION_ID_CHOICE_C == d_selectionId);
939 return d_choiceC.object();
940}
941
942inline
944{
945 BSLS_ASSERT(SELECTION_ID_CHOICE_D == d_selectionId);
946 return d_choiceD.object();
947}
948
949inline
951{
952 return SELECTION_ID_CHOICE_C == d_selectionId;
953}
954
955inline
957{
958 return SELECTION_ID_CHOICE_D == d_selectionId;
959}
960
961inline
963{
964 return SELECTION_ID_UNDEFINED == d_selectionId;
965}
966
967
968 // ---------------------------
969 // class MySequenceWithChoices
970 // ---------------------------
971
972// CLASS METHODS
973// MANIPULATORS
974template <typename t_MANIPULATOR>
975int MySequenceWithChoices::manipulateAttributes(t_MANIPULATOR& manipulator)
976{
977 int ret;
978
979 ret = manipulator(&d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
980 if (ret) {
981 return ret;
982 }
983
984 ret = manipulator(&d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
985 if (ret) {
986 return ret;
987 }
988
989 return 0;
990}
991
992template <typename t_MANIPULATOR>
993int MySequenceWithChoices::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
994{
995 enum { NOT_FOUND = -1 };
996
997 switch (id) {
998 case ATTRIBUTE_ID_FIRST: {
999 return manipulator(&d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
1000 }
1001 case ATTRIBUTE_ID_SECOND: {
1002 return manipulator(&d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
1003 }
1004 default:
1005 return NOT_FOUND;
1006 }
1007}
1008
1009template <typename t_MANIPULATOR>
1011 t_MANIPULATOR& manipulator,
1012 const char *name,
1013 int nameLength)
1014{
1015 enum { NOT_FOUND = -1 };
1016
1017 const bdlat_AttributeInfo *attributeInfo =
1018 lookupAttributeInfo(name, nameLength);
1019 if (0 == attributeInfo) {
1020 return NOT_FOUND;
1021 }
1022
1023 return manipulateAttribute(manipulator, attributeInfo->d_id);
1024}
1025
1026inline
1031
1032inline
1037
1038// ACCESSORS
1039template <typename t_ACCESSOR>
1040int MySequenceWithChoices::accessAttributes(t_ACCESSOR& accessor) const
1041{
1042 int ret;
1043
1044 ret = accessor(d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
1045 if (ret) {
1046 return ret;
1047 }
1048
1049 ret = accessor(d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
1050 if (ret) {
1051 return ret;
1052 }
1053
1054 return 0;
1055}
1056
1057template <typename t_ACCESSOR>
1058int MySequenceWithChoices::accessAttribute(t_ACCESSOR& accessor, int id) const
1059{
1060 enum { NOT_FOUND = -1 };
1061
1062 switch (id) {
1063 case ATTRIBUTE_ID_FIRST: {
1064 return accessor(d_first, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_FIRST]);
1065 }
1066 case ATTRIBUTE_ID_SECOND: {
1067 return accessor(d_second, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_SECOND]);
1068 }
1069 default:
1070 return NOT_FOUND;
1071 }
1072}
1073
1074template <typename t_ACCESSOR>
1076 t_ACCESSOR& accessor,
1077 const char *name,
1078 int nameLength) const
1079{
1080 enum { NOT_FOUND = -1 };
1081
1082 const bdlat_AttributeInfo *attributeInfo =
1083 lookupAttributeInfo(name, nameLength);
1084 if (0 == attributeInfo) {
1085 return NOT_FOUND;
1086 }
1087
1088 return accessAttribute(accessor, attributeInfo->d_id);
1089}
1090
1091inline
1093{
1094 return d_first;
1095}
1096
1097inline
1099{
1100 return d_second;
1101}
1102
1103} // close package namespace
1104
1105// FREE FUNCTIONS
1106
1107
1108#endif
1109
1110// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
1111// USING bas_codegen.pl s_baltst_mysequencewithchoices.xsd --mode msg --includedir . --msgComponent mysequencewithchoices --noRecurse --noExternalization --noHashSupport --noAggregateConversion
1112// ----------------------------------------------------------------------------
1113// NOTICE:
1114// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
1115// Property of Bloomberg Finance L.P. (BFLP)
1116// This software is made available solely pursuant to the
1117// terms of a BFLP license agreement which governs its use.
1118// ------------------------------- END-OF-FILE --------------------------------
1119
1120/** @} */
1121/** @} */
1122/** @} */
Definition s_baltst_mysequencewithchoices.h:69
static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[]
Definition s_baltst_mysequencewithchoices.h:103
bool isChoiceBValue() const
Definition s_baltst_mysequencewithchoices.h:830
const char * selectionName() const
Return the symbolic name of the current selection of this object.
bsls::ObjectBuffer< int > d_choiceB
Definition s_baltst_mysequencewithchoices.h:74
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithchoices.h:101
int makeSelection(const char *name, int nameLength)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
static const bdlat_SelectionInfo * lookupSelectionInfo(int id)
bool isUndefinedValue() const
Definition s_baltst_mysequencewithchoices.h:836
int & choiceA()
Definition s_baltst_mysequencewithchoices.h:773
bsls::ObjectBuffer< int > d_choiceA
Definition s_baltst_mysequencewithchoices.h:73
~MySequenceWithChoicesChoice1()
Destroy this object.
Definition s_baltst_mysequencewithchoices.h:750
MySequenceWithChoicesChoice1 & operator=(const MySequenceWithChoicesChoice1 &rhs)
Assign to this object the value of the specified rhs object.
static const bdlat_SelectionInfo * lookupSelectionInfo(const char *name, int nameLength)
friend bool operator!=(const MySequenceWithChoicesChoice1 &lhs, const MySequenceWithChoicesChoice1 &rhs)
Definition s_baltst_mysequencewithchoices.h:272
MySequenceWithChoicesChoice1()
Definition s_baltst_mysequencewithchoices.h:744
int manipulateSelection(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithchoices.h:757
bool isChoiceAValue() const
Definition s_baltst_mysequencewithchoices.h:824
@ NUM_SELECTIONS
Definition s_baltst_mysequencewithchoices.h:92
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithChoicesChoice1 &rhs)
Definition s_baltst_mysequencewithchoices.h:280
@ SELECTION_ID_CHOICE_B
Definition s_baltst_mysequencewithchoices.h:88
@ SELECTION_ID_CHOICE_A
Definition s_baltst_mysequencewithchoices.h:87
@ SELECTION_ID_UNDEFINED
Definition s_baltst_mysequencewithchoices.h:86
MySequenceWithChoicesChoice1(const MySequenceWithChoicesChoice1 &original)
int & choiceB()
Definition s_baltst_mysequencewithchoices.h:780
friend bool operator==(const MySequenceWithChoicesChoice1 &lhs, const MySequenceWithChoicesChoice1 &rhs)
Definition s_baltst_mysequencewithchoices.h:263
int accessSelection(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithchoices.h:794
int selectionId() const
Definition s_baltst_mysequencewithchoices.h:788
@ SELECTION_INDEX_CHOICE_A
Definition s_baltst_mysequencewithchoices.h:96
@ SELECTION_INDEX_CHOICE_B
Definition s_baltst_mysequencewithchoices.h:97
Definition s_baltst_mysequencewithchoices.h:299
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithchoices.h:331
int makeSelection(const char *name, int nameLength)
bool isUndefinedValue() const
Definition s_baltst_mysequencewithchoices.h:962
static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[]
Definition s_baltst_mysequencewithchoices.h:333
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithChoicesChoice2 &rhs)
Definition s_baltst_mysequencewithchoices.h:510
int accessSelection(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithchoices.h:920
@ SELECTION_INDEX_CHOICE_D
Definition s_baltst_mysequencewithchoices.h:327
@ SELECTION_INDEX_CHOICE_C
Definition s_baltst_mysequencewithchoices.h:326
static const bdlat_SelectionInfo * lookupSelectionInfo(int id)
~MySequenceWithChoicesChoice2()
Destroy this object.
Definition s_baltst_mysequencewithchoices.h:876
int selectionId() const
Definition s_baltst_mysequencewithchoices.h:914
friend bool operator==(const MySequenceWithChoicesChoice2 &lhs, const MySequenceWithChoicesChoice2 &rhs)
Definition s_baltst_mysequencewithchoices.h:493
static const bdlat_SelectionInfo * lookupSelectionInfo(const char *name, int nameLength)
int manipulateSelection(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithchoices.h:883
MySequenceWithChoicesChoice2 & operator=(const MySequenceWithChoicesChoice2 &rhs)
Assign to this object the value of the specified rhs object.
int & choiceC()
Definition s_baltst_mysequencewithchoices.h:899
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
const char * selectionName() const
Return the symbolic name of the current selection of this object.
MySequenceWithChoicesChoice2(const MySequenceWithChoicesChoice2 &original)
bsls::ObjectBuffer< int > d_choiceD
Definition s_baltst_mysequencewithchoices.h:304
MySequenceWithChoicesChoice2()
Definition s_baltst_mysequencewithchoices.h:870
bool isChoiceCValue() const
Definition s_baltst_mysequencewithchoices.h:950
bsls::ObjectBuffer< int > d_choiceC
Definition s_baltst_mysequencewithchoices.h:303
int & choiceD()
Definition s_baltst_mysequencewithchoices.h:906
bool isChoiceDValue() const
Definition s_baltst_mysequencewithchoices.h:956
friend bool operator!=(const MySequenceWithChoicesChoice2 &lhs, const MySequenceWithChoicesChoice2 &rhs)
Definition s_baltst_mysequencewithchoices.h:502
@ NUM_SELECTIONS
Definition s_baltst_mysequencewithchoices.h:322
@ SELECTION_ID_UNDEFINED
Definition s_baltst_mysequencewithchoices.h:316
@ SELECTION_ID_CHOICE_C
Definition s_baltst_mysequencewithchoices.h:317
@ SELECTION_ID_CHOICE_D
Definition s_baltst_mysequencewithchoices.h:318
Definition s_baltst_mysequencewithchoices.h:529
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithchoices.h:552
@ ATTRIBUTE_ID_FIRST
Definition s_baltst_mysequencewithchoices.h:538
@ ATTRIBUTE_ID_SECOND
Definition s_baltst_mysequencewithchoices.h:539
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithchoices.h:993
int accessAttributes(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithchoices.h:1040
MySequenceWithChoicesChoice2 & second()
Definition s_baltst_mysequencewithchoices.h:1033
friend bool operator==(const MySequenceWithChoices &lhs, const MySequenceWithChoices &rhs)
Definition s_baltst_mysequencewithchoices.h:679
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithchoices.h:543
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithchoices.h:975
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithChoices &rhs)
Definition s_baltst_mysequencewithchoices.h:695
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
@ ATTRIBUTE_INDEX_SECOND
Definition s_baltst_mysequencewithchoices.h:548
@ ATTRIBUTE_INDEX_FIRST
Definition s_baltst_mysequencewithchoices.h:547
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
friend bool operator!=(const MySequenceWithChoices &lhs, const MySequenceWithChoices &rhs)
Returns !(lhs == rhs)
Definition s_baltst_mysequencewithchoices.h:687
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithchoices.h:554
MySequenceWithChoicesChoice1 & first()
Definition s_baltst_mysequencewithchoices.h:1027
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithchoices.h:1058
#define BDLAT_DECL_CHOICE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:261
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:294
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#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_selectioninfo.h:138
Definition bdlat_typetraits.h:146
TYPE & object()
Definition bsls_objectbuffer.h:352