BDE 4.14.0 Production release
Loading...
Searching...
No Matches
s_baltst_mysequencewithdoubleattribute.h
Go to the documentation of this file.
1/// @file s_baltst_mysequencewithdoubleattribute.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// s_baltst_mysequencewithdoubleattribute.h *DO NOT EDIT* @generated -*-C++-*-
8#ifndef INCLUDED_S_BALTST_MYSEQUENCEWITHDOUBLEATTRIBUTE
9#define INCLUDED_S_BALTST_MYSEQUENCEWITHDOUBLEATTRIBUTE
10
11#include <bsls_ident.h>
12BSLS_IDENT_RCSID(s_baltst_mysequencewithdoubleattribute_h, "$Id$ $CSID$")
14
15/// @defgroup s_baltst_mysequencewithdoubleattribute s_baltst_mysequencewithdoubleattribute
16/// @brief Provide value-semantic attribute classes
17/// @addtogroup Standalones
18/// @{
19/// @addtogroup s_baltst
20/// @{
21/// @addtogroup s_baltst_mysequencewithdoubleattribute
22/// @{
23///
24/// <h1> Outline </h1>
25/// * <a href="#s_baltst_mysequencewithdoubleattribute-purpose"> Purpose</a>
26///
27/// # Purpose {#s_baltst_mysequencewithdoubleattribute-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_mysequencewithdoubleattribute
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 <bdlb_nullablevalue.h>
56
57#include <bsl_iosfwd.h>
58#include <bsl_limits.h>
59
60
61
62namespace s_baltst { class MySequenceWithDoubleAttribute; }
63namespace s_baltst {
64
65 // ===================================
66 // class MySequenceWithDoubleAttribute
67 // ===================================
68
70
71 // INSTANCE DATA
72 bdlb::NullableValue<double> d_attribute1;
73
74 public:
75 // TYPES
76 enum {
78 };
79
80 enum {
82 };
83
84 enum {
86 };
87
88 // CONSTANTS
89 static const char CLASS_NAME[];
90
92
93 public:
94 // CLASS METHODS
95
96 /// Return attribute information for the attribute indicated by the
97 /// specified `id` if the attribute exists, and 0 otherwise.
99
100 /// Return attribute information for the attribute indicated by the
101 /// specified `name` of the specified `nameLength` if the attribute
102 /// exists, and 0 otherwise.
104 const char *name,
105 int nameLength);
106
107 // CREATORS
108
109 /// Create an object of type `MySequenceWithDoubleAttribute` having the
110 /// default value.
112
113 /// Create an object of type `MySequenceWithDoubleAttribute` having the
114 /// value of the specified `original` object.
116
117#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
118 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
119 /// Create an object of type `MySequenceWithDoubleAttribute` having the
120 /// value of the specified `original` object. After performing this
121 /// action, the `original` object will be left in a valid, but
122 /// unspecified state.
124#endif
125
126 /// Destroy this object.
128
129 // MANIPULATORS
130
131 /// Assign to this object the value of the specified `rhs` object.
133
134#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) \
135 && defined(BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT)
136 /// Assign to this object the value of the specified `rhs` object.
137 /// After performing this action, the `rhs` object will be left in a
138 /// valid, but unspecified state.
140#endif
141
142 /// Reset this object to the default value (i.e., its value upon
143 /// default construction).
144 void reset();
145
146 /// Invoke the specified `manipulator` sequentially on the address of
147 /// each (modifiable) attribute of this object, supplying `manipulator`
148 /// with the corresponding attribute information structure until such
149 /// invocation returns a non-zero value. Return the value from the
150 /// last invocation of `manipulator` (i.e., the invocation that
151 /// terminated the sequence).
152 template<class MANIPULATOR>
153 int manipulateAttributes(MANIPULATOR& manipulator);
154
155 /// Invoke the specified `manipulator` on the address of
156 /// the (modifiable) attribute indicated by the specified `id`,
157 /// supplying `manipulator` with the corresponding attribute
158 /// information structure. Return the value returned from the
159 /// invocation of `manipulator` if `id` identifies an attribute of this
160 /// class, and -1 otherwise.
161 template<class MANIPULATOR>
162 int manipulateAttribute(MANIPULATOR& manipulator, int id);
163
164 /// Invoke the specified `manipulator` on the address of
165 /// the (modifiable) attribute indicated by the specified `name` of the
166 /// specified `nameLength`, supplying `manipulator` with the
167 /// corresponding attribute information structure. Return the value
168 /// returned from the invocation of `manipulator` if `name` identifies
169 /// an attribute of this class, and -1 otherwise.
170 template<class MANIPULATOR>
171 int manipulateAttribute(MANIPULATOR& manipulator,
172 const char *name,
173 int nameLength);
174
175 /// Return a reference to the modifiable "Attribute1" attribute of this
176 /// object.
178
179 // ACCESSORS
180
181 /// Format this object to the specified output `stream` at the
182 /// optionally specified indentation `level` and return a reference to
183 /// the modifiable `stream`. If `level` is specified, optionally
184 /// specify `spacesPerLevel`, the number of spaces per indentation level
185 /// for this and all of its nested objects. Each line is indented by
186 /// the absolute value of `level * spacesPerLevel`. If `level` is
187 /// negative, suppress indentation of the first line. If
188 /// `spacesPerLevel` is negative, suppress line breaks and format the
189 /// entire output on one line. If `stream` is initially invalid, this
190 /// operation has no effect. Note that a trailing newline is provided
191 /// in multiline mode only.
192 bsl::ostream& print(bsl::ostream& stream,
193 int level = 0,
194 int spacesPerLevel = 4) const;
195
196 /// Invoke the specified `accessor` sequentially on each
197 /// (non-modifiable) attribute of this object, supplying `accessor`
198 /// with the corresponding attribute information structure until such
199 /// invocation returns a non-zero value. Return the value from the
200 /// last invocation of `accessor` (i.e., the invocation that terminated
201 /// the sequence).
202 template<class ACCESSOR>
203 int accessAttributes(ACCESSOR& accessor) const;
204
205 /// Invoke the specified `accessor` on the (non-modifiable) attribute
206 /// of this object indicated by the specified `id`, supplying `accessor`
207 /// with the corresponding attribute information structure. Return the
208 /// value returned from the invocation of `accessor` if `id` identifies
209 /// an attribute of this class, and -1 otherwise.
210 template<class ACCESSOR>
211 int accessAttribute(ACCESSOR& accessor, int id) const;
212
213 /// Invoke the specified `accessor` on the (non-modifiable) attribute
214 /// of this object indicated by the specified `name` of the specified
215 /// `nameLength`, supplying `accessor` with the corresponding attribute
216 /// information structure. Return the value returned from the
217 /// invocation of `accessor` if `name` identifies an attribute of this
218 /// class, and -1 otherwise.
219 template<class ACCESSOR>
220 int accessAttribute(ACCESSOR& accessor,
221 const char *name,
222 int nameLength) const;
223
224 /// Return a reference offering non-modifiable access to the
225 /// "Attribute1" attribute of this object.
227};
228
229// FREE OPERATORS
230
231/// Return `true` if the specified `lhs` and `rhs` attribute objects have
232/// the same value, and `false` otherwise. Two attribute objects have the
233/// same value if each respective attribute has the same value.
234inline
235bool operator==(const MySequenceWithDoubleAttribute& lhs, const MySequenceWithDoubleAttribute& rhs);
236
237/// Return `true` if the specified `lhs` and `rhs` attribute objects do not
238/// have the same value, and `false` otherwise. Two attribute objects do
239/// not have the same value if one or more respective attributes differ in
240/// values.
241inline
242bool operator!=(const MySequenceWithDoubleAttribute& lhs, const MySequenceWithDoubleAttribute& rhs);
243
244/// Format the specified `rhs` to the specified output `stream` and
245/// return a reference to the modifiable `stream`.
246inline
247bsl::ostream& operator<<(bsl::ostream& stream, const MySequenceWithDoubleAttribute& rhs);
248
249} // close package namespace
250
251// TRAITS
252
254
255// ============================================================================
256// INLINE FUNCTION DEFINITIONS
257// ============================================================================
258
259namespace s_baltst {
260
261 // -----------------------------------
262 // class MySequenceWithDoubleAttribute
263 // -----------------------------------
264
265// CLASS METHODS
266// MANIPULATORS
267template <class MANIPULATOR>
269{
270 int ret;
271
272 ret = manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
273 if (ret) {
274 return ret;
275 }
276
277 return 0;
278}
279
280template <class MANIPULATOR>
281int MySequenceWithDoubleAttribute::manipulateAttribute(MANIPULATOR& manipulator, int id)
282{
283 enum { NOT_FOUND = -1 };
284
285 switch (id) {
287 return manipulator(&d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
288 }
289 default:
290 return NOT_FOUND;
291 }
292}
293
294template <class MANIPULATOR>
296 MANIPULATOR& manipulator,
297 const char *name,
298 int nameLength)
299{
300 enum { NOT_FOUND = -1 };
301
302 const bdlat_AttributeInfo *attributeInfo =
303 lookupAttributeInfo(name, nameLength);
304 if (0 == attributeInfo) {
305 return NOT_FOUND;
306 }
307
308 return manipulateAttribute(manipulator, attributeInfo->d_id);
309}
310
311inline
316
317// ACCESSORS
318template <class ACCESSOR>
320{
321 int ret;
322
323 ret = accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
324 if (ret) {
325 return ret;
326 }
327
328 return 0;
329}
330
331template <class ACCESSOR>
332int MySequenceWithDoubleAttribute::accessAttribute(ACCESSOR& accessor, int id) const
333{
334 enum { NOT_FOUND = -1 };
335
336 switch (id) {
338 return accessor(d_attribute1, ATTRIBUTE_INFO_ARRAY[ATTRIBUTE_INDEX_ATTRIBUTE1]);
339 }
340 default:
341 return NOT_FOUND;
342 }
343}
344
345template <class ACCESSOR>
347 ACCESSOR& accessor,
348 const char *name,
349 int nameLength) const
350{
351 enum { NOT_FOUND = -1 };
352
353 const bdlat_AttributeInfo *attributeInfo =
354 lookupAttributeInfo(name, nameLength);
355 if (0 == attributeInfo) {
356 return NOT_FOUND;
357 }
358
359 return accessAttribute(accessor, attributeInfo->d_id);
360}
361
362inline
364{
365 return d_attribute1;
366}
367
368} // close package namespace
369
370// FREE FUNCTIONS
371
372inline
376{
377 return lhs.attribute1() == rhs.attribute1();
378}
379
380inline
384{
385 return !(lhs == rhs);
386}
387
388inline
389bsl::ostream& s_baltst::operator<<(
390 bsl::ostream& stream,
392{
393 return rhs.print(stream, 0, -1);
394}
395
396
397#endif
398
399// GENERATED BY @BLP_BAS_CODEGEN_VERSION@
400// USING bas_codegen.pl s_baltst_mysequencewithdoubleattribute.xsd --mode msg --includedir . --msgComponent mysequencewithdoubleattribute --noRecurse --noExternalization --noHashSupport --noAggregateConversion
401// ----------------------------------------------------------------------------
402// NOTICE:
403// Copyright 2022 Bloomberg Finance L.P. All rights reserved.
404// Property of Bloomberg Finance L.P. (BFLP)
405// This software is made available solely pursuant to the
406// terms of a BFLP license agreement which governs its use.
407// ------------------------------- END-OF-FILE --------------------------------
408
409/** @} */
410/** @} */
411/** @} */
Definition bdlb_nullablevalue.h:257
Definition s_baltst_mysequencewithdoubleattribute.h:69
~MySequenceWithDoubleAttribute()
Destroy this object.
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
static const bdlat_AttributeInfo * lookupAttributeInfo(int id)
@ ATTRIBUTE_ID_ATTRIBUTE1
Definition s_baltst_mysequencewithdoubleattribute.h:77
int accessAttributes(ACCESSOR &accessor) const
Definition s_baltst_mysequencewithdoubleattribute.h:319
static const bdlat_AttributeInfo * lookupAttributeInfo(const char *name, int nameLength)
static const bdlat_AttributeInfo ATTRIBUTE_INFO_ARRAY[]
Definition s_baltst_mysequencewithdoubleattribute.h:91
int manipulateAttribute(MANIPULATOR &manipulator, int id)
Definition s_baltst_mysequencewithdoubleattribute.h:281
@ NUM_ATTRIBUTES
Definition s_baltst_mysequencewithdoubleattribute.h:81
@ ATTRIBUTE_INDEX_ATTRIBUTE1
Definition s_baltst_mysequencewithdoubleattribute.h:85
int manipulateAttributes(MANIPULATOR &manipulator)
Definition s_baltst_mysequencewithdoubleattribute.h:268
static const char CLASS_NAME[]
Definition s_baltst_mysequencewithdoubleattribute.h:89
MySequenceWithDoubleAttribute & operator=(const MySequenceWithDoubleAttribute &rhs)
Assign to this object the value of the specified rhs object.
MySequenceWithDoubleAttribute(const MySequenceWithDoubleAttribute &original)
bdlb::NullableValue< double > & attribute1()
Definition s_baltst_mysequencewithdoubleattribute.h:312
int accessAttribute(ACCESSOR &accessor, int id) const
Definition s_baltst_mysequencewithdoubleattribute.h:332
#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