BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlar_anymanipulators.h
Go to the documentation of this file.
1/// @file bdlar_anymanipulators.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlar_anymanipulators.h -*-C++-*-
8#ifndef INCLUDED_BDLAR_ANYMANIPULATORS
9#define INCLUDED_BDLAR_ANYMANIPULATORS
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bdlar_anymanipulators bdlar_anymanipulators
15/// @brief Provide ...
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlar
19/// @{
20/// @addtogroup bdlar_anymanipulators
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlar_anymanipulators-purpose"> Purpose</a>
25/// * <a href="#bdlar_anymanipulators-description"> Description </a>
26///
27/// # Purpose {#bdlar_anymanipulators-purpose}
28/// Provide ...
29///
30/// # Description {#bdlar_anymanipulators-description}
31/// This component provides ...
32///
33/// @}
34/** @} */
35/** @} */
36
37/** @addtogroup bdl
38 * @{
39 */
40/** @addtogroup bdlar
41 * @{
42 */
43/** @addtogroup bdlar_anymanipulators
44 * @{
45 */
46
47#include <bdlar_anyref.h>
48
49#include <bdlar_arrayref.h>
50#include <bdlar_choiceref.h>
53#include <bdlar_enumref.h>
55#include <bdlar_sequenceref.h>
56#include <bdlar_simpletyperef.h>
57
58#include <bdlat_typecategory.h>
59
60
61namespace bdlar {
62
63
64// ============================================================================
65// INLINE DEFINITIONS
66// ============================================================================
67
68 // ------------
69 // class AnyRef
70 // ------------
71
72// FREE FUNCTIONS
73// Customization-point functions
74
75template <class t_MANIPULATOR>
76inline
78 t_MANIPULATOR& manipulator)
79{
81 ArrayRef ref(any->objectAddress(), any->arrayVtable());
82 return manipulator(&ref, bdlat_TypeCategory::Array()); // RETURN
83 }
84 return manipulator(any, bslmf::Nil());
85}
86
87template <class t_MANIPULATOR>
88inline
89int bdlat_typeCategoryManipulateChoice(AnyRef *any, t_MANIPULATOR& manipulator)
90{
92 ChoiceRef ref(any->objectAddress(), any->choiceVtable());
93 return manipulator(&ref, bdlat_TypeCategory::Choice()); // RETURN
94 }
95 return manipulator(any, bslmf::Nil());
96}
97
98template <class t_MANIPULATOR>
99inline
101 t_MANIPULATOR& manipulator)
102{
103 if (any->typeCategory() ==
106 any->customizedTypeVtable());
107 return manipulator(&ref, bdlat_TypeCategory::CustomizedType());
108 // RETURN
109 }
110 return manipulator(any, bslmf::Nil());
111}
112
113template <class t_MANIPULATOR>
114inline
116 t_MANIPULATOR& manipulator)
117{
119 EnumRef ref(any->objectAddress(), any->enumVtable());
120 return manipulator(&ref, bdlat_TypeCategory::Enumeration()); // RETURN
121 }
122 return manipulator(any, bslmf::Nil());
123}
124
125template <class t_MANIPULATOR>
126inline
128 t_MANIPULATOR& manipulator)
129{
132 return manipulator(&ref, bdlat_TypeCategory::NullableValue());
133 // RETURN
134 }
135 return manipulator(any, bslmf::Nil());
136}
137
138template <class t_MANIPULATOR>
139inline
141 t_MANIPULATOR& manipulator)
142{
144 SequenceRef ref(any->objectAddress(), any->sequenceVtable());
145 return manipulator(&ref, bdlat_TypeCategory::Sequence()); // RETURN
146 }
147 return manipulator(any, bslmf::Nil());
148}
149
150template <class t_MANIPULATOR>
151inline
153 t_MANIPULATOR& manipulator)
154{
156 SimpleTypeRef ref(any->objectAddress(), any->simpleTypeVtable());
157 return ref.manipulateWithCategory(manipulator); // RETURN
158 }
159 return manipulator(any, bslmf::Nil());
160}
161
162template <class t_ACCESSOR>
163inline
164int bdlat_typeCategoryAccessArray(const AnyRef& any, t_ACCESSOR& accessor)
165{
167 const ArrayRef ref(any.objectAddress(), any.arrayVtable());
168 return accessor(ref, bdlat_TypeCategory::Array()); // RETURN
169 }
170 return accessor(any, bslmf::Nil());
171}
172
173template <class t_ACCESSOR>
174inline
175int bdlat_typeCategoryAccessChoice(const AnyRef& any, t_ACCESSOR& accessor)
176{
178 const ChoiceRef ref(any.objectAddress(), any.choiceVtable());
179 return accessor(ref, bdlat_TypeCategory::Choice()); // RETURN
180 }
181 return accessor(any, bslmf::Nil());
182}
183
184template <class t_ACCESSOR>
185inline
187 t_ACCESSOR& accessor)
188{
190 const CustomizedTypeRef ref(any.objectAddress(),
192 return accessor(ref, bdlat_TypeCategory::CustomizedType()); // RETURN
193 }
194 return accessor(any, bslmf::Nil());
195}
196
197template <class t_ACCESSOR>
198inline
200 t_ACCESSOR& accessor)
201{
203 const EnumRef ref(any.objectAddress(), any.enumVtable());
204 return accessor(ref, bdlat_TypeCategory::Enumeration()); // RETURN
205 }
206 return accessor(any, bslmf::Nil());
207}
208
209template <class t_ACCESSOR>
210inline
212 t_ACCESSOR& accessor)
213{
215 const NullableValueRef ref(any.objectAddress(),
216 any.nullableValueVtable());
217 return accessor(ref, bdlat_TypeCategory::NullableValue()); // RETURN
218 }
219 return accessor(any, bslmf::Nil());
220}
221
222template <class t_ACCESSOR>
223inline
224int bdlat_typeCategoryAccessSequence(const AnyRef& any, t_ACCESSOR& accessor)
225{
227 const SequenceRef ref(any.objectAddress(), any.sequenceVtable());
228 return accessor(ref, bdlat_TypeCategory::Sequence()); // RETURN
229 }
230 return accessor(any, bslmf::Nil());
231}
232
233template <class t_ACCESSOR>
234inline
235int bdlat_typeCategoryAccessSimple(const AnyRef& any, t_ACCESSOR& accessor)
236{
238 const SimpleTypeRef ref(any.objectAddress(), any.simpleTypeVtable());
239 return ref.accessWithCategory(accessor); // RETURN
240 }
241 return accessor(any, bslmf::Nil());
242}
243
244 // -----------------
245 // class AnyConstRef
246 // -----------------
247
248// FREE FUNCTIONS
249// Customization-point functions
250
251template <class t_ACCESSOR>
252inline
253int bdlat_typeCategoryAccessArray(const AnyConstRef& any, t_ACCESSOR& accessor)
254{
256 const ArrayConstRef ref(any.objectAddress(), any.arrayVtable());
257 return accessor(ref, bdlat_TypeCategory::Array()); // RETURN
258 }
259 return accessor(any, bslmf::Nil());
260}
261
262template <class t_ACCESSOR>
263inline
265 t_ACCESSOR& accessor)
266{
268 const ChoiceConstRef ref(any.objectAddress(), any.choiceVtable());
269 return accessor(ref, bdlat_TypeCategory::Choice()); // RETURN
270 }
271 return accessor(any, bslmf::Nil());
272}
273
274template <class t_ACCESSOR>
275inline
277 t_ACCESSOR& accessor)
278{
282 return accessor(ref, bdlat_TypeCategory::CustomizedType()); // RETURN
283 }
284 return accessor(any, bslmf::Nil());
285}
286
287template <class t_ACCESSOR>
288inline
290 t_ACCESSOR& accessor)
291{
293 const EnumConstRef ref(any.objectAddress(), any.enumVtable());
294 return accessor(ref, bdlat_TypeCategory::Enumeration()); // RETURN
295 }
296 return accessor(any, bslmf::Nil());
297}
298
299template <class t_ACCESSOR>
300inline
302 t_ACCESSOR& accessor)
303{
305 const NullableValueConstRef ref(any.objectAddress(),
306 any.nullableValueVtable());
307 return accessor(ref, bdlat_TypeCategory::NullableValue()); // RETURN
308 }
309 return accessor(any, bslmf::Nil());
310}
311
312template <class t_ACCESSOR>
313inline
315 t_ACCESSOR& accessor)
316{
318 const SequenceConstRef ref(any.objectAddress(), any.sequenceVtable());
319 return accessor(ref, bdlat_TypeCategory::Sequence()); // RETURN
320 }
321 return accessor(any, bslmf::Nil());
322}
323
324template <class t_ACCESSOR>
325inline
327 t_ACCESSOR& accessor)
328{
330 const SimpleTypeConstRef ref(any.objectAddress(),
331 any.simpleTypeVtable());
332 return ref.accessWithCategory(accessor); // RETURN
333 }
334 return accessor(any, bslmf::Nil());
335}
336
337} // close package namespace
338
339
340#endif
341
342// ----------------------------------------------------------------------------
343// Copyright 2024 Bloomberg Finance L.P.
344//
345// Licensed under the Apache License, Version 2.0 (the "License");
346// you may not use this file except in compliance with the License.
347// You may obtain a copy of the License at
348//
349// http://www.apache.org/licenses/LICENSE-2.0
350//
351// Unless required by applicable law or agreed to in writing, software
352// distributed under the License is distributed on an "AS IS" BASIS,
353// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
354// See the License for the specific language governing permissions and
355// limitations under the License.
356// ----------------------------- END-OF-FILE ----------------------------------
357
358/** @} */
359/** @} */
360/** @} */
Definition bdlar_anyref.h:247
const EnumConstVtable * enumVtable() const
Definition bdlar_anyref.h:678
const CustomizedTypeConstVtable * customizedTypeVtable() const
Definition bdlar_anyref.h:666
const ChoiceConstVtable * choiceVtable() const
Definition bdlar_anyref.h:660
const void * objectAddress() const
Return a pointer to the wrapped object.
Definition bdlar_anyref.h:702
const SimpleTypeConstVtable * simpleTypeVtable() const
Definition bdlar_anyref.h:696
const NullableValueConstVtable * nullableValueVtable() const
Definition bdlar_anyref.h:684
bdlat_TypeCategory::Value typeCategory() const
Return type category of the referred object.
Definition bdlar_anyref.h:708
const SequenceConstVtable * sequenceVtable() const
Definition bdlar_anyref.h:690
const ArrayConstVtable * arrayVtable() const
Definition bdlar_anyref.h:654
Definition bdlar_anyref.h:85
const NullableValueVtable * nullableValueVtable() const
Definition bdlar_anyref.h:512
void * objectAddress() const
Return a pointer to the wrapped object.
Definition bdlar_anyref.h:530
const SequenceVtable * sequenceVtable() const
Definition bdlar_anyref.h:518
bdlat_TypeCategory::Value typeCategory() const
Return type category of the referred object.
Definition bdlar_anyref.h:536
const SimpleTypeVtable * simpleTypeVtable() const
Definition bdlar_anyref.h:524
const ArrayVtable * arrayVtable() const
Definition bdlar_anyref.h:482
const CustomizedTypeVtable * customizedTypeVtable() const
Definition bdlar_anyref.h:494
const ChoiceVtable * choiceVtable() const
Definition bdlar_anyref.h:488
const EnumVtable * enumVtable() const
Definition bdlar_anyref.h:506
Definition bdlar_arrayref.h:147
Definition bdlar_arrayref.h:72
Definition bdlar_choiceref.h:160
Definition bdlar_choiceref.h:68
Definition bdlar_customizedtyperef.h:136
Definition bdlar_customizedtyperef.h:73
Definition bdlar_enumref.h:138
Definition bdlar_enumref.h:68
Definition bdlar_nullablevalueref.h:147
Definition bdlar_nullablevalueref.h:72
Definition bdlar_sequenceref.h:205
Definition bdlar_sequenceref.h:68
Definition bdlar_simpletyperef.h:216
Definition bdlar_simpletyperef.h:68
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlar_accessorref.h:59
int bdlat_typeCategoryManipulateChoice(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:89
int bdlat_typeCategoryManipulateArray(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:77
int bdlat_typeCategoryAccessCustomizedType(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:186
int bdlat_typeCategoryAccessSimple(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:235
int bdlat_typeCategoryAccessArray(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:164
int bdlat_typeCategoryAccessChoice(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:175
int bdlat_typeCategoryManipulateCustomizedType(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:100
int bdlat_typeCategoryManipulateEnumeration(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:115
int bdlat_typeCategoryAccessNullableValue(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:211
int bdlat_typeCategoryManipulateSimple(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:152
int bdlat_typeCategoryManipulateNullableValue(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:127
int bdlat_typeCategoryManipulateSequence(AnyRef *any, t_MANIPULATOR &manipulator)
Definition bdlar_anymanipulators.h:140
int bdlat_typeCategoryAccessSequence(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:224
int bdlat_typeCategoryAccessEnumeration(const AnyRef &any, t_ACCESSOR &accessor)
Definition bdlar_anymanipulators.h:199
Definition bdlat_typecategory.h:1037
Definition bdlat_typecategory.h:1038
Definition bdlat_typecategory.h:1039
Definition bdlat_typecategory.h:1040
Definition bdlat_typecategory.h:1041
Definition bdlat_typecategory.h:1042
@ e_ARRAY_CATEGORY
Definition bdlat_typecategory.h:1048
@ e_CHOICE_CATEGORY
Definition bdlat_typecategory.h:1049
@ e_SEQUENCE_CATEGORY
Definition bdlat_typecategory.h:1053
@ e_SIMPLE_CATEGORY
Definition bdlat_typecategory.h:1054
@ e_CUSTOMIZED_TYPE_CATEGORY
Definition bdlat_typecategory.h:1050
@ e_NULLABLE_VALUE_CATEGORY
Definition bdlat_typecategory.h:1052
@ e_ENUMERATION_CATEGORY
Definition bdlat_typecategory.h:1051
Definition bslmf_nil.h:133