BDE 4.14.0 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 /// Create an object of type `UnsignedSequence` having the value of the
120 /// specified `original` object.
122
123#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
124 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
125 /// Create an object of type `UnsignedSequence` having the value of the
126 /// specified `original` object. After performing this action, the
127 /// `original` object will be left in a valid, but unspecified state.
128 UnsignedSequence(UnsignedSequence&& original) = default;
129#endif
130
131 /// Destroy this object.
133
134 // MANIPULATORS
135
136 /// Assign to this object the value of the specified `rhs` object.
138
139#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
140 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
141 /// Assign to this object the value of the specified `rhs` object.
142 /// After performing this action, the `rhs` object will be left in a
143 /// valid, but unspecified state.
145#endif
146
147 /// Reset this object to the default value (i.e., its value upon
148 /// default construction).
149 void reset();
150
151 /// Invoke the specified `manipulator` sequentially on the address of
152 /// each (modifiable) attribute of this object, supplying `manipulator`
153 /// with the corresponding attribute information structure until such
154 /// invocation returns a non-zero value. Return the value from the
155 /// last invocation of `manipulator` (i.e., the invocation that
156 /// terminated the sequence).
157 template<class MANIPULATOR>
158 int manipulateAttributes(MANIPULATOR& manipulator);
159
160 /// Invoke the specified `manipulator` on the address of
161 /// the (modifiable) attribute indicated by the specified `id`,
162 /// supplying `manipulator` with the corresponding attribute
163 /// information structure. Return the value returned from the
164 /// invocation of `manipulator` if `id` identifies an attribute of this
165 /// class, and -1 otherwise.
166 template<class MANIPULATOR>
167 int manipulateAttribute(MANIPULATOR& manipulator, int id);
168
169 /// Invoke the specified `manipulator` on the address of
170 /// the (modifiable) attribute indicated by the specified `name` of the
171 /// specified `nameLength`, supplying `manipulator` with the
172 /// corresponding attribute information structure. Return the value
173 /// returned from the invocation of `manipulator` if `name` identifies
174 /// an attribute of this class, and -1 otherwise.
175 template<class MANIPULATOR>
176 int manipulateAttribute(MANIPULATOR& manipulator,
177 const char *name,
178 int nameLength);
179
180 /// Return a reference to the modifiable "Element1" attribute of this
181 /// object.
182 unsigned int& element1();
183
184 /// Return a reference to the modifiable "Element2" attribute of this
185 /// object.
186 unsigned short& element2();
187
188 /// Return a reference to the modifiable "Element3" attribute of this
189 /// object.
191
192 // ACCESSORS
193
194 /// Format this object to the specified output `stream` at the
195 /// optionally specified indentation `level` and return a reference to
196 /// the modifiable `stream`. If `level` is specified, optionally
197 /// specify `spacesPerLevel`, the number of spaces per indentation level
198 /// for this and all of its nested objects. Each line is indented by
199 /// the absolute value of `level * spacesPerLevel`. If `level` is
200 /// negative, suppress indentation of the first line. If
201 /// `spacesPerLevel` is negative, suppress line breaks and format the
202 /// entire output on one line. If `stream` is initially invalid, this
203 /// operation has no effect. Note that a trailing newline is provided
204 /// in multiline mode only.
205 bsl::ostream& print(bsl::ostream& stream,
206 int level = 0,
207 int spacesPerLevel = 4) const;
208
209 /// Invoke the specified `accessor` sequentially on each
210 /// (non-modifiable) attribute of this object, supplying `accessor`
211 /// with the corresponding attribute information structure until such
212 /// invocation returns a non-zero value. Return the value from the
213 /// last invocation of `accessor` (i.e., the invocation that terminated
214 /// the sequence).
215 template<class ACCESSOR>
216 int accessAttributes(ACCESSOR& accessor) const;
217
218 /// Invoke the specified `accessor` on the (non-modifiable) attribute
219 /// of this object indicated by the specified `id`, supplying `accessor`
220 /// with the corresponding attribute information structure. Return the
221 /// value returned from the invocation of `accessor` if `id` identifies
222 /// an attribute of this class, and -1 otherwise.
223 template<class ACCESSOR>
224 int accessAttribute(ACCESSOR& accessor, int id) const;
225
226 /// Invoke the specified `accessor` on the (non-modifiable) attribute
227 /// of this object indicated by the specified `name` of the specified
228 /// `nameLength`, supplying `accessor` with the corresponding attribute
229 /// information structure. Return the value returned from the
230 /// invocation of `accessor` if `name` identifies an attribute of this
231 /// class, and -1 otherwise.
232 template<class ACCESSOR>
233 int accessAttribute(ACCESSOR& accessor,
234 const char *name,
235 int nameLength) const;
236
237 /// Return the value of the "Element1" attribute of this object.
238 unsigned int element1() const;
239
240 /// Return the value of the "Element2" attribute of this object.
241 unsigned short element2() const;
242
243 /// Return the value of the "Element3" attribute of this object.
245};
246
247// FREE OPERATORS
248
249/// Return `true` if the specified `lhs` and `rhs` attribute objects have
250/// the same value, and `false` otherwise. Two attribute objects have the
251/// same value if each respective attribute has the same value.
252inline
253bool operator==(const UnsignedSequence& lhs, const UnsignedSequence& rhs);
254
255/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
256/// have the same value, and `false` otherwise. Two attribute objects do
257/// not have the same value if one or more respective attributes differ in
258/// values.
259inline
260bool operator!=(const UnsignedSequence& lhs, const UnsignedSequence& rhs);
261
262/// Format the specified `rhs` to the specified output `stream` and
263/// return a reference to the modifiable `stream`.
264inline
265bsl::ostream& operator<<(bsl::ostream& stream, const UnsignedSequence& rhs);
266
267} // close package namespace
268
269// TRAITS
270
272
273// ============================================================================
274// INLINE FUNCTION DEFINITIONS
275// ============================================================================
276
277namespace s_baltst {
278
279 // ----------------------
280 // class UnsignedSequence
281 // ----------------------
282
283// CLASS METHODS
284// MANIPULATORS
285template <class MANIPULATOR>
286int UnsignedSequence::manipulateAttributes(MANIPULATOR& manipulator)
287{
288 int ret;
289
290 ret = manipulator(&d_element1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT1]);
291 if (ret) {
292 return ret;
293 }
294
295 ret = manipulator(&d_element2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT2]);
296 if (ret) {
297 return ret;
298 }
299
300 ret = manipulator(&d_element3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT3]);
301 if (ret) {
302 return ret;
303 }
304
305 return 0;
306}
307
308template <class MANIPULATOR>
309int UnsignedSequence::manipulateAttribute(MANIPULATOR& manipulator, int id)
310{
311 enum { NOT_FOUND = -1 };
312
313 switch (id) {
315 return manipulator(&d_element1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT1]);
316 }
318 return manipulator(&d_element2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT2]);
319 }
321 return manipulator(&d_element3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT3]);
322 }
323 default:
324 return NOT_FOUND;
325 }
326}
327
328template <class MANIPULATOR>
330 MANIPULATOR& manipulator,
331 const char *name,
332 int nameLength)
333{
334 enum { NOT_FOUND = -1 };
335
336 const bdlat_AttributeInfo *attributeInfo =
337 lookupAttributeInfo(name, nameLength);
338 if (0 == attributeInfo) {
339 return NOT_FOUND;
340 }
341
342 return manipulateAttribute(manipulator, attributeInfo->d_id);
343}
344
345inline
347{
348 return d_element1;
349}
350
351inline
353{
354 return d_element2;
355}
356
357inline
359{
360 return d_element3;
361}
362
363// ACCESSORS
364template <class ACCESSOR>
365int UnsignedSequence::accessAttributes(ACCESSOR& accessor) const
366{
367 int ret;
368
369 ret = accessor(d_element1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT1]);
370 if (ret) {
371 return ret;
372 }
373
374 ret = accessor(d_element2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT2]);
375 if (ret) {
376 return ret;
377 }
378
379 ret = accessor(d_element3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT3]);
380 if (ret) {
381 return ret;
382 }
383
384 return 0;
385}
386
387template <class ACCESSOR>
388int UnsignedSequence::accessAttribute(ACCESSOR& accessor, int id) const
389{
390 enum { NOT_FOUND = -1 };
391
392 switch (id) {
394 return accessor(d_element1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT1]);
395 }
397 return accessor(d_element2, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT2]);
398 }
400 return accessor(d_element3, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ELEMENT3]);
401 }
402 default:
403 return NOT_FOUND;
404 }
405}
406
407template <class ACCESSOR>
409 ACCESSOR& accessor,
410 const char *name,
411 int nameLength) const
412{
413 enum { NOT_FOUND = -1 };
414
415 const bdlat_AttributeInfo *attributeInfo =
416 lookupAttributeInfo(name, nameLength);
417 if (0 == attributeInfo) {
418 return NOT_FOUND;
419 }
420
421 return accessAttribute(accessor, attributeInfo->d_id);
422}
423
424inline
425unsigned int UnsignedSequence::element1() const
426{
427 return d_element1;
428}
429
430inline
431unsigned short UnsignedSequence::element2() const
432{
433 return d_element2;
434}
435
436inline
438{
439 return d_element3;
440}
441
442} // close package namespace
443
444// FREE FUNCTIONS
445
446inline
450{
451 return lhs.element1() == rhs.element1()
452 && lhs.element2() == rhs.element2()
453 && lhs.element3() == rhs.element3();
454}
455
456inline
460{
461 return !(lhs == rhs);
462}
463
464inline
465bsl::ostream& s_baltst::operator<<(
466 bsl::ostream& stream,
468{
469 return rhs.print(stream, 0, -1);
470}
471
472
473#endif
474
475// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
476// USING bas_codegen.pl s_baltst_unsignedsequence.xsd --mode msg --includedir . --msgComponent unsignedsequence --noRecurse --noExternalization --noHashSupport --noAggregateConversion
477// ----------------------------------------------------------------------------
478// NOTICE:
479// Copyright 2022 Bloomberg Finance L.P. All rights reserved.
480// Property of Bloomberg Finance L.P. (BFLP)
481// This software is made available solely pursuant to the
482// terms of a BFLP license agreement which governs its use.
483// ------------------------------- END-OF-FILE --------------------------------
484
485/** @} */
486/** @} */
487/** @} */
Definition s_baltst_unsignedsequence.h:69
unsigned int & element1()
Definition s_baltst_unsignedsequence.h:346
@ 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
int accessAttribute(ACCESSOR &accessor, int id) const
Definition s_baltst_unsignedsequence.h:388
UnsignedSequence & operator=(const UnsignedSequence &rhs)
Assign to this object the value of the specified rhs object.
UnsignedSequence(const UnsignedSequence &original)
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)
~UnsignedSequence()
Destroy this object.
int manipulateAttributes(MANIPULATOR &manipulator)
Definition s_baltst_unsignedsequence.h:286
static const char CLASS_NAME[]
Definition s_baltst_unsignedsequence.h:95
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_unsignedsequence.h:97
int accessAttributes(ACCESSOR &accessor) const
Definition s_baltst_unsignedsequence.h:365
unsigned short & element2()
Definition s_baltst_unsignedsequence.h:352
int manipulateAttribute(MANIPULATOR &manipulator, int id)
Definition s_baltst_unsignedsequence.h:309
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
bsls::Types::Uint64 & element3()
Definition s_baltst_unsignedsequence.h:358
@ 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
#define BDLAT_DECL_SEQUENCE_WITH_BITWISEMOVEABLE_TRAITS(ClassName)
Definition bdlat_typetraits.h:275
#define BSLS_IDENT_RCSID(tag, str)
Definition bsls_ident.h:260
#define BSLS_IDENT_PRAGMA_ONCE
Definition bsls_ident.h:310
Definition s_baltst_address.h:66
bool operator!=(const Address &lhs, const Address &rhs)
bool operator==(const Address &lhs, const Address &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const Address &rhs)
Definition bdlat_attributeinfo.h:137
int d_id
Definition bdlat_attributeinfo.h:140
unsigned long long Uint64
Definition bsls_types.h:137