BDE 4.39.x Production Release
Loading...
Searching...
No Matches
s_baltst_mysequencewithanonymouschoice.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewithanonymouschoice.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewithanonymouschoice.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHANONYMOUSCHOICE
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHANONYMOUSCHOICE
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewithanonymouschoice_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewithanonymouschoice s_baltst_mysequencewithanonymouschoice
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewithanonymouschoice
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewithanonymouschoice-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewithanonymouschoice-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_mysequencewithanonymouschoice
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 <bdlb_nullablevalue.h>
58
59#include <bsl_string.h>
60
61#include <bsl_iosfwd.h>
62#include <bsl_limits.h>
63
64
65
66namespace bslma { class Allocator; }
67
68namespace s_baltst { class MySequenceWithAnonymousChoiceChoice; }
69namespace s_baltst { class MySequenceWithAnonymousChoice; }
70namespace s_baltst {
71
72 // =========================================
73 // class MySequenceWithAnonymousChoiceChoice
74 // =========================================
75
77
78 // INSTANCE DATA
79 union {
82 };
83
84 int d_selectionId;
85 bslma::Allocator *d_allocator_p;
86
87 // PRIVATE ACCESSORS
88 bool isEqualTo(const MySequenceWithAnonymousChoiceChoice& rhs) const;
89
90 public:
91 // TYPES
92
93 enum {
97 };
98
99 enum {
101 };
102
103 enum {
106 };
107
108 // CONSTANTS
109 static const char CLASS_NAME[];
110
112
113 // CLASS METHODS
114
115 /// Return selection information for the selection indicated by the
116 /// specified `id` if the selection exists, and 0 otherwise.
118
119 /// Return selection information for the selection indicated by the
120 /// specified `name` of the specified `nameLength` if the selection
121 /// exists, and 0 otherwise.
123 const char *name,
124 int nameLength);
125
126 // CREATORS
127
128 /// Create an object of type `MySequenceWithAnonymousChoiceChoice`
129 /// having the default value. Use the optionally specified
130 /// `basicAllocator` to supply memory. If `basicAllocator` is 0, the
131 /// currently installed default allocator is used.
132 explicit MySequenceWithAnonymousChoiceChoice(bslma::Allocator *basicAllocator = 0);
133
134 /// Create an object of type `MySequenceWithAnonymousChoiceChoice`
135 /// having the value of the specified `original` object. Use the
136 /// optionally specified `basicAllocator` to supply memory. If
137 /// `basicAllocator` is 0, the currently installed default allocator is
138 /// used.
140 bslma::Allocator *basicAllocator = 0);
141
142#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
143 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
144 /// Create an object of type `MySequenceWithAnonymousChoiceChoice`
145 /// having the value of the specified `original` object. After
146 /// performing this action, the `original` object will be left in a
147 /// valid, but unspecified state.
149
150 /// Create an object of type `MySequenceWithAnonymousChoiceChoice`
151 /// having the value of the specified `original` object. After
152 /// performing this action, the `original` object will be left in a
153 /// valid, but unspecified state. Use the optionally specified
154 /// `basicAllocator` to supply memory. If `basicAllocator` is 0, the
155 /// currently installed default allocator is used.
157 bslma::Allocator *basicAllocator);
158#endif
159
160 /// Destroy this object.
162
163 // MANIPULATORS
164
165 /// Assign to this object the value of the specified `rhs` object.
167
168#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
169 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
170 /// Assign to this object the value of the specified `rhs` object.
171 /// After performing this action, the `rhs` object will be left in a
172 /// valid, but unspecified state.
174#endif
175
176 /// Reset this object to the default value (i.e., its value upon default
177 /// construction).
178 void reset();
179
180 /// Set the value of this object to be the default for the selection
181 /// indicated by the specified `selectionId`. Return 0 on success, and
182 /// non-zero value otherwise (i.e., the selection is not found).
184
185 /// Set the value of this object to be the default for the selection
186 /// indicated by the specified `name` of the specified `nameLength`.
187 /// Return 0 on success, and non-zero value otherwise (i.e., the
188 /// selection is not found).
189 int makeSelection(const char *name, int nameLength);
190
191 /// Set the value of this object to be a "MyChoice1" value. Optionally
192 /// specify the `value` of the "MyChoice1". If `value` is not
193 /// specified, the default "MyChoice1" value is used.
195 int& makeMyChoice1(int value);
196
199#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
200 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
202#endif
203 // Set the value of this object to be a "MyChoice2" value. Optionally
204 // specify the 'value' of the "MyChoice2". If 'value' is not
205 // specified, the default "MyChoice2" value is used.
206
207 /// Invoke the specified `manipulator` on the address of the modifiable
208 /// selection, supplying `manipulator` with the corresponding selection
209 /// information structure. Return the value returned from the
210 /// invocation of `manipulator` if this object has a defined selection,
211 /// and -1 otherwise.
212 template <typename t_MANIPULATOR>
213 int manipulateSelection(t_MANIPULATOR& manipulator);
214
215 /// Return a reference to the modifiable "MyChoice1" selection of this
216 /// object if "MyChoice1" is the current selection.
217 ///
218 /// \pre The behavior is undefined unless "MyChoice1" is the selection of this object.
219 int& myChoice1();
220
221 /// Return a reference to the modifiable "MyChoice2" selection of this
222 /// object if "MyChoice2" is the current selection.
223 ///
224 /// \pre The behavior is undefined unless "MyChoice2" is the selection of this object.
226
227 // ACCESSORS
228
229 /// Format this object to the specified output `stream` at the
230 /// optionally specified indentation `level` and return a reference to
231 /// the modifiable `stream`. If `level` is specified, optionally
232 /// specify `spacesPerLevel`, the number of spaces per indentation level
233 /// for this and all of its nested objects. Each line is indented by
234 /// the absolute value of `level * spacesPerLevel`. If `level` is
235 /// negative, suppress indentation of the first line. If
236 /// `spacesPerLevel` is negative, suppress line breaks and format the
237 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
238 ///
239 /// \note Note that a trailing newline is provided
240 /// in multiline mode only.
241 bsl::ostream& print(bsl::ostream& stream,
242 int level = 0,
243 int spacesPerLevel = 4) const;
244
245 /// Return the id of the current selection if the selection is defined,
246 /// and -1 otherwise.
247 int selectionId() const;
248
249 /// Invoke the specified `accessor` on the non-modifiable selection,
250 /// supplying `accessor` with the corresponding selection information
251 /// structure. Return the value returned from the invocation of
252 /// `accessor` if this object has a defined selection, and -1 otherwise.
253 template <typename t_ACCESSOR>
254 int accessSelection(t_ACCESSOR& accessor) const;
255
256 /// Return a reference to the non-modifiable "MyChoice1" selection of
257 /// this object if "MyChoice1" is the current selection.
258 ///
259 /// \pre The behavior is undefined unless "MyChoice1" is the selection of this object.
260 const int& myChoice1() const;
261
262 /// Return a reference to the non-modifiable "MyChoice2" selection of
263 /// this object if "MyChoice2" is the current selection.
264 ///
265 /// \pre The behavior is undefined unless "MyChoice2" is the selection of this object.
266 const bsl::string& myChoice2() const;
267
268 /// Return `true` if the value of this object is a "MyChoice1" value,
269 /// and return `false` otherwise.
270 bool isMyChoice1Value() const;
271
272 /// Return `true` if the value of this object is a "MyChoice2" value,
273 /// and return `false` otherwise.
274 bool isMyChoice2Value() const;
275
276 /// Return `true` if the value of this object is undefined, and `false`
277 /// otherwise.
278 bool isUndefinedValue() const;
279
280 /// Return the symbolic name of the current selection of this object.
281 const char *selectionName() const;
282
283 // HIDDEN FRIENDS
284
285 /// Return `true` if the specified `lhs` and `rhs` objects have the same
286 /// value, and `false` otherwise. Two
287 /// `MySequenceWithAnonymousChoiceChoice` objects have the same value if
288 /// either the selections in both objects have the same ids and the same
289 /// values, or both selections are undefined.
292 {
293 return lhs.isEqualTo(rhs);
294 }
295
296 /// Return `true` if the specified `lhs` and `rhs` objects do not have
297 /// the same values, as determined by `operator==`, and `false`
298 /// otherwise.
301 {
302 return !(lhs == rhs);
303 }
304
305 /// Format the specified `rhs` to the specified output `stream` and
306 /// return a reference to the modifiable `stream`.
307 friend bsl::ostream& operator<<(
308 bsl::ostream& stream,
310 {
311 return rhs.print(stream, 0, -1);
312 }
313};
314
315} // close package namespace
316
317// TRAITS
318
320
321namespace s_baltst {
322
323 // ===================================
324 // class MySequenceWithAnonymousChoice
325 // ===================================
326
328
329 // INSTANCE DATA
332 bdlb::NullableValue<int> d_attribute1;
333
334 public:
335 // TYPES
336 enum {
340 };
341
342 enum {
344 };
345
346 enum {
350 };
351
352 // CONSTANTS
353 static const char CLASS_NAME[];
354
356
357 public:
358 // CLASS METHODS
359
360 /// Return attribute information for the attribute indicated by the
361 /// specified `id` if the attribute exists, and 0 otherwise.
363
364 /// Return attribute information for the attribute indicated by the
365 /// specified `name` of the specified `nameLength` if the attribute
366 /// exists, and 0 otherwise.
368 const char *name,
369 int nameLength);
370
371 // CREATORS
372
373 /// Create an object of type `MySequenceWithAnonymousChoice` having the
374 /// default value. Use the optionally specified `basicAllocator` to
375 /// supply memory. If `basicAllocator` is 0, the currently installed
376 /// default allocator is used.
377 explicit MySequenceWithAnonymousChoice(bslma::Allocator *basicAllocator = 0);
378
379 /// Create an object of type `MySequenceWithAnonymousChoice` having the
380 /// value of the specified `original` object. Use the optionally
381 /// specified `basicAllocator` to supply memory. If `basicAllocator` is
382 /// 0, the currently installed default allocator is used.
384 bslma::Allocator *basicAllocator = 0);
385
386#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
387 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
388 /// Create an object of type `MySequenceWithAnonymousChoice` having the
389 /// value of the specified `original` object. After performing this
390 /// action, the `original` object will be left in a valid, but
391 /// unspecified state.
393
394 /// Create an object of type `MySequenceWithAnonymousChoice` having the
395 /// value of the specified `original` object. After performing this
396 /// action, the `original` object will be left in a valid, but
397 /// unspecified state. Use the optionally specified `basicAllocator` to
398 /// supply memory. If `basicAllocator` is 0, the currently installed
399 /// default allocator is used.
401 bslma::Allocator *basicAllocator);
402#endif
403
404 /// Destroy this object.
406
407 // MANIPULATORS
408
409 /// Assign to this object the value of the specified `rhs` object.
411
412#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
413 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
414 /// Assign to this object the value of the specified `rhs` object.
415 /// After performing this action, the `rhs` object will be left in a
416 /// valid, but unspecified state.
418#endif
419
420 /// Reset this object to the default value (i.e., its value upon
421 /// default construction).
422 void reset();
423
424 /// Invoke the specified `manipulator` sequentially on the address of
425 /// each (modifiable) attribute of this object, supplying `manipulator`
426 /// with the corresponding attribute information structure until such
427 /// invocation returns a non-zero value. Return the value from the
428 /// last invocation of `manipulator` (i.e., the invocation that
429 /// terminated the sequence).
430 template <typename t_MANIPULATOR>
431 int manipulateAttributes(t_MANIPULATOR& manipulator);
432
433 /// Invoke the specified `manipulator` on the address of
434 /// the (modifiable) attribute indicated by the specified `id`,
435 /// supplying `manipulator` with the corresponding attribute
436 /// information structure. Return the value returned from the
437 /// invocation of `manipulator` if `id` identifies an attribute of this
438 /// class, and -1 otherwise.
439 template <typename t_MANIPULATOR>
440 int manipulateAttribute(t_MANIPULATOR& manipulator, int id);
441
442 /// Invoke the specified `manipulator` on the address of
443 /// the (modifiable) attribute indicated by the specified `name` of the
444 /// specified `nameLength`, supplying `manipulator` with the
445 /// corresponding attribute information structure. Return the value
446 /// returned from the invocation of `manipulator` if `name` identifies
447 /// an attribute of this class, and -1 otherwise.
448 template <typename t_MANIPULATOR>
449 int manipulateAttribute(t_MANIPULATOR& manipulator,
450 const char *name,
451 int nameLength);
452
453 /// Return a reference to the modifiable "Attribute1" attribute of this
454 /// object.
456
457 /// Return a reference to the modifiable "Choice" attribute of this
458 /// object.
460
461 /// Return a reference to the modifiable "Attribute2" attribute of this
462 /// object.
464
465 // ACCESSORS
466
467 /// Format this object to the specified output `stream` at the
468 /// optionally specified indentation `level` and return a reference to
469 /// the modifiable `stream`. If `level` is specified, optionally
470 /// specify `spacesPerLevel`, the number of spaces per indentation level
471 /// for this and all of its nested objects. Each line is indented by
472 /// the absolute value of `level * spacesPerLevel`. If `level` is
473 /// negative, suppress indentation of the first line. If
474 /// `spacesPerLevel` is negative, suppress line breaks and format the
475 /// entire output on one line. If `stream` is initially invalid, this operation has no effect.
476 ///
477 /// \note Note that a trailing newline is provided
478 /// in multiline mode only.
479 bsl::ostream& print(bsl::ostream& stream,
480 int level = 0,
481 int spacesPerLevel = 4) const;
482
483 /// Invoke the specified `accessor` sequentially on each
484 /// (non-modifiable) attribute of this object, supplying `accessor`
485 /// with the corresponding attribute information structure until such
486 /// invocation returns a non-zero value. Return the value from the
487 /// last invocation of `accessor` (i.e., the invocation that terminated
488 /// the sequence).
489 template <typename t_ACCESSOR>
490 int accessAttributes(t_ACCESSOR& accessor) const;
491
492 /// Invoke the specified `accessor` on the (non-modifiable) attribute
493 /// of this object indicated by the specified `id`, supplying `accessor`
494 /// with the corresponding attribute information structure. Return the
495 /// value returned from the invocation of `accessor` if `id` identifies
496 /// an attribute of this class, and -1 otherwise.
497 template <typename t_ACCESSOR>
498 int accessAttribute(t_ACCESSOR& accessor, int id) const;
499
500 /// Invoke the specified `accessor` on the (non-modifiable) attribute
501 /// of this object indicated by the specified `name` of the specified
502 /// `nameLength`, supplying `accessor` with the corresponding attribute
503 /// information structure. Return the value returned from the
504 /// invocation of `accessor` if `name` identifies an attribute of this
505 /// class, and -1 otherwise.
506 template <typename t_ACCESSOR>
507 int accessAttribute(t_ACCESSOR& accessor,
508 const char *name,
509 int nameLength) const;
510
511 /// Return a reference offering non-modifiable access to the
512 /// "Attribute1" attribute of this object.
514
515 /// Return a reference offering non-modifiable access to the "Choice"
516 /// attribute of this object.
518
519 /// Return a reference offering non-modifiable access to the
520 /// "Attribute2" attribute of this object.
522
523 // HIDDEN FRIENDS
524
525 /// Return `true` if the specified `lhs` and `rhs` attribute objects
526 /// have the same value, and `false` otherwise. Two attribute objects
527 /// have the same value if each respective attribute has the same value.
530 {
531 return lhs.attribute1() == rhs.attribute1() &&
532 lhs.choice() == rhs.choice() &&
533 lhs.attribute2() == rhs.attribute2();
534 }
535
536 /// Returns `!(lhs == rhs)`
539 {
540 return !(lhs == rhs);
541 }
542
543 /// Format the specified `rhs` to the specified output `stream` and
544 /// return a reference to the modifiable `stream`.
545 friend bsl::ostream& operator<<(
546 bsl::ostream& stream,
548 {
549 return rhs.print(stream, 0, -1);
550 }
551};
552
553} // close package namespace
554
555// TRAITS
556
558template <>
559struct bdlat_UsesDefaultValueFlag<s_baltst::MySequenceWithAnonymousChoice> : bsl::true_type {};
560
561// ============================================================================
562// INLINE DEFINITIONS
563// ============================================================================
564
565namespace s_baltst {
566
567 // -----------------------------------------
568 // class MySequenceWithAnonymousChoiceChoice
569 // -----------------------------------------
570
571// CLASS METHODS
572// PRIVATE ACCESSORS
573inline
574bool MySequenceWithAnonymousChoiceChoice::isEqualTo(const MySequenceWithAnonymousChoiceChoice& rhs) const
575{
576 typedef MySequenceWithAnonymousChoiceChoice Class;
577 if (this->selectionId() == rhs.selectionId()) {
578 switch (rhs.selectionId()) {
579 case Class::SELECTION_ID_MY_CHOICE1:
580 return this->myChoice1() == rhs.myChoice1();
581 case Class::SELECTION_ID_MY_CHOICE2:
582 return this->myChoice2() == rhs.myChoice2();
583 default:
584 BSLS_ASSERT(Class::SELECTION_ID_UNDEFINED == rhs.selectionId());
585 return true;
586 }
587 }
588 else {
589 return false;
590 }
591}
592
593// CREATORS
594inline
596: d_selectionId(SELECTION_ID_UNDEFINED)
597, d_allocator_p(bslma::Default::allocator(basicAllocator))
598{
599}
600
601inline
606
607// MANIPULATORS
608template <typename t_MANIPULATOR>
623
624inline
630
631inline
637
638// ACCESSORS
639inline
641{
642 return d_selectionId;
643}
644
645template <typename t_ACCESSOR>
647{
648 switch (d_selectionId) {
650 return accessor(d_myChoice1.object(),
653 return accessor(d_myChoice2.object(),
655 default:
656 BSLS_ASSERT(SELECTION_ID_UNDEFINED == d_selectionId);
657 return -1;
658 }
659}
660
661inline
663{
664 BSLS_ASSERT(SELECTION_ID_MY_CHOICE1 == d_selectionId);
665 return d_myChoice1.object();
666}
667
668inline
670{
671 BSLS_ASSERT(SELECTION_ID_MY_CHOICE2 == d_selectionId);
672 return d_myChoice2.object();
673}
674
675inline
677{
678 return SELECTION_ID_MY_CHOICE1 == d_selectionId;
679}
680
681inline
683{
684 return SELECTION_ID_MY_CHOICE2 == d_selectionId;
685}
686
687inline
689{
690 return SELECTION_ID_UNDEFINED == d_selectionId;
691}
692
693
694 // -----------------------------------
695 // class MySequenceWithAnonymousChoice
696 // -----------------------------------
697
698// CLASS METHODS
699// MANIPULATORS
700template <typename t_MANIPULATOR>
702{
703 int ret;
704
705 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
706 if (ret) {
707 return ret;
708 }
709
710 ret = manipulator(&d_choice, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CHOICE]);
711 if (ret) {
712 return ret;
713 }
714
715 ret = manipulator(&d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
716 if (ret) {
717 return ret;
718 }
719
720 return 0;
721}
722
723template <typename t_MANIPULATOR>
724int MySequenceWithAnonymousChoice::manipulateAttribute(t_MANIPULATOR& manipulator, int id)
725{
726 enum { NOT_FOUND = -1 };
727
728 switch (id) {
730 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
731 }
732 case ATTRIBUTE_ID_CHOICE: {
733 return manipulator(&d_choice, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CHOICE]);
734 }
736 return manipulator(&d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
737 }
738 default:
739 return NOT_FOUND;
740 }
741}
742
743template <typename t_MANIPULATOR>
745 t_MANIPULATOR& manipulator,
746 const char *name,
747 int nameLength)
748{
749 enum { NOT_FOUND = -1 };
750
751 const bdlat_AttributeInfo *attributeInfo =
752 lookupAttributeInfo(name, nameLength);
753 if (0 == attributeInfo) {
754 return NOT_FOUND;
755 }
756
757 return manipulateAttribute(manipulator, attributeInfo->d_id);
758}
759
760inline
765
766inline
771
772inline
777
778// ACCESSORS
779template <typename t_ACCESSOR>
781{
782 int ret;
783
784 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
785 if (ret) {
786 return ret;
787 }
788
789 ret = accessor(d_choice, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CHOICE]);
790 if (ret) {
791 return ret;
792 }
793
794 ret = accessor(d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
795 if (ret) {
796 return ret;
797 }
798
799 return 0;
800}
801
802template <typename t_ACCESSOR>
803int MySequenceWithAnonymousChoice::accessAttribute(t_ACCESSOR& accessor, int id) const
804{
805 enum { NOT_FOUND = -1 };
806
807 switch (id) {
809 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
810 }
811 case ATTRIBUTE_ID_CHOICE: {
812 return accessor(d_choice, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_CHOICE]);
813 }
815 return accessor(d_attribute2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE2]);
816 }
817 default:
818 return NOT_FOUND;
819 }
820}
821
822template <typename t_ACCESSOR>
824 t_ACCESSOR& accessor,
825 const char *name,
826 int nameLength) const
827{
828 enum { NOT_FOUND = -1 };
829
830 const bdlat_AttributeInfo *attributeInfo =
831 lookupAttributeInfo(name, nameLength);
832 if (0 == attributeInfo) {
833 return NOT_FOUND;
834 }
835
836 return accessAttribute(accessor, attributeInfo->d_id);
837}
838
839inline
841{
842 return d_attribute1;
843}
844
845inline
850
851inline
853{
854 return d_attribute2;
855}
856
857} // close package namespace
858
859// FREE FUNCTIONS
860
861
862#endif
863
864// GENERATED BY BLP_BAS_CODEGEN_2025.08.21
865// USING bas_codegen.pl s_baltst_mysequencewithanonymouschoice.xsd --mode msg --includedir . --msgComponent mysequencewithanonymouschoice --noRecurse --noExternalization --noHashSupport --noAggregateConversion
866// ----------------------------------------------------------------------------
867// NOTICE:
868// Copyright 2025 Bloomberg Finance L.P. All rights reserved.
869// Property of Bloomberg Finance L.P. (BFLP)
870// This software is made available solely pursuant to the
871// terms of a BFLP license agreement which governs its use.
872// ------------------------------- END-OF-FILE --------------------------------
873
874/** @} */
875/** @} */
876/** @} */
Definition bdlb_nullablevalue.h:262
Definition bslstl_string.h:1252
Definition bslma_allocator.h:545
Definition s_baltst_mysequencewithanonymouschoice.h:76
bsls::ObjectBuffer< int > d_myChoice1
Definition s_baltst_mysequencewithanonymouschoice.h:80
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessSelection(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithanonymouschoice.h:646
bsls::ObjectBuffer< bsl::string > d_myChoice2
Definition s_baltst_mysequencewithanonymouschoice.h:81
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithanonymouschoice.h:109
const char * selectionName() const
Return the symbolic name of the current selection of this object.
@ NUM_SELECTIONS
Definition s_baltst_mysequencewithanonymouschoice.h:100
static const bdlat_SelectionInfo * lookupSelectionInfo(int id)
@ SELECTION_INDEX_MY_CHOICE2
Definition s_baltst_mysequencewithanonymouschoice.h:105
@ SELECTION_INDEX_MY_CHOICE1
Definition s_baltst_mysequencewithanonymouschoice.h:104
bool isMyChoice2Value() const
Definition s_baltst_mysequencewithanonymouschoice.h:682
bsl::string & myChoice2()
Definition s_baltst_mysequencewithanonymouschoice.h:632
MySequenceWithAnonymousChoiceChoice(bslma::Allocator *basicAllocator=0)
Definition s_baltst_mysequencewithanonymouschoice.h:595
bool isMyChoice1Value() const
Definition s_baltst_mysequencewithanonymouschoice.h:676
~MySequenceWithAnonymousChoiceChoice()
Destroy this object.
Definition s_baltst_mysequencewithanonymouschoice.h:602
int selectionId() const
Definition s_baltst_mysequencewithanonymouschoice.h:640
int & myChoice1()
Definition s_baltst_mysequencewithanonymouschoice.h:625
int makeSelection(const char *name, int nameLength)
friend bool operator!=(const MySequenceWithAnonymousChoiceChoice &lhs, const MySequenceWithAnonymousChoiceChoice &rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:299
MySequenceWithAnonymousChoiceChoice & operator=(const MySequenceWithAnonymousChoiceChoice &rhs)
Assign to this object the value of the specified rhs object.
bool isUndefinedValue() const
Definition s_baltst_mysequencewithanonymouschoice.h:688
int manipulateSelection(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithanonymouschoice.h:609
MySequenceWithAnonymousChoiceChoice(const MySequenceWithAnonymousChoiceChoice &original, bslma::Allocator *basicAllocator=0)
static const bdlat_SelectionInfo * lookupSelectionInfo(const char *name, int nameLength)
static const bdlat_SelectionInfo SELECTION_INFO_ARRAY[]
Definition s_baltst_mysequencewithanonymouschoice.h:111
bsl::string & makeMyChoice2(const bsl::string &value)
friend bool operator==(const MySequenceWithAnonymousChoiceChoice &lhs, const MySequenceWithAnonymousChoiceChoice &rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:290
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithAnonymousChoiceChoice &rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:307
@ SELECTION_ID_UNDEFINED
Definition s_baltst_mysequencewithanonymouschoice.h:94
@ SELECTION_ID_MY_CHOICE1
Definition s_baltst_mysequencewithanonymouschoice.h:95
@ SELECTION_ID_MY_CHOICE2
Definition s_baltst_mysequencewithanonymouschoice.h:96
Definition s_baltst_mysequencewithanonymouschoice.h:327
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
int accessAttribute(t_ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithanonymouschoice.h:803
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithanonymouschoice.h:355
MySequenceWithAnonymousChoice & operator=(const MySequenceWithAnonymousChoice &rhs)
Assign to this object the value of the specified rhs object.
friend bool operator!=(const MySequenceWithAnonymousChoice &lhs, const MySequenceWithAnonymousChoice &rhs)
Returns !(lhs == rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:537
MySequenceWithAnonymousChoice(const MySequenceWithAnonymousChoice &original, bslma::Allocator *basicAllocator=0)
int manipulateAttributes(t_MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithanonymouschoice.h:701
friend bool operator==(const MySequenceWithAnonymousChoice &lhs, const MySequenceWithAnonymousChoice &rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:528
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewithanonymouschoice.h:337
@ ATTRIBUTE_ID_CHOICE
Definition s_baltst_mysequencewithanonymouschoice.h:338
@ ATTRIBUTE_ID_ATTRIBUTE2
Definition s_baltst_mysequencewithanonymouschoice.h:339
friend bsl::ostream & operator<<(bsl::ostream &stream, const MySequenceWithAnonymousChoice &rhs)
Definition s_baltst_mysequencewithanonymouschoice.h:545
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithanonymouschoice.h:353
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
~MySequenceWithAnonymousChoice()
Destroy this object.
MySequenceWithAnonymousChoiceChoice & choice()
Definition s_baltst_mysequencewithanonymouschoice.h:767
int manipulateAttribute(t_MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithanonymouschoice.h:724
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithanonymouschoice.h:343
@ ATTRIBUTE_INDEX_ATTRIBUTE2
Definition s_baltst_mysequencewithanonymouschoice.h:349
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewithanonymouschoice.h:347
@ ATTRIBUTE_INDEX_CHOICE
Definition s_baltst_mysequencewithanonymouschoice.h:348
int accessAttributes(t_ACCESSOR &accessor) const
Definition s_baltst_mysequencewithanonymouschoice.h:780
MySequenceWithAnonymousChoice(bslma::Allocator *basicAllocator=0)
bdlb::NullableValue< int > & attribute1()
Definition s_baltst_mysequencewithanonymouschoice.h:761
bdlb::NullableValue< bsl::string > & attribute2()
Definition s_baltst_mysequencewithanonymouschoice.h:773
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
#define BDLAT_DECL_CHOICE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:268
#define BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:301
#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 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_selectioninfo.h:138
Definition bdlat_typetraits.h:146
TYPE & object()
Definition bsls_objectbuffer.h:352