BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlar_manipulatorref.h
Go to the documentation of this file.
1/// @file bdlar_manipulatorref.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlar_manipulatorref.h -*-C++-*-
8#ifndef INCLUDED_BDLAR_MANIPULATORREF
9#define INCLUDED_BDLAR_MANIPULATORREF
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bdlar_manipulatorref bdlar_manipulatorref
15/// @brief Provide ...
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlar
19/// @{
20/// @addtogroup bdlar_manipulatorref
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlar_manipulatorref-purpose"> Purpose</a>
25/// * <a href="#bdlar_manipulatorref-classes"> Classes </a>
26/// * <a href="#bdlar_manipulatorref-description"> Description </a>
27///
28/// # Purpose {#bdlar_manipulatorref-purpose}
29/// Provide ...
30///
31/// # Classes {#bdlar_manipulatorref-classes}
32///
33/// - bdlar::ManipulatorRef: ...
34/// - bdlar::ManipulatorWithInfoRef: ...
35///
36/// # Description {#bdlar_manipulatorref-description}
37/// This component provides ...
38///
39/// @}
40/** @} */
41/** @} */
42
43/** @addtogroup bdl
44 * @{
45 */
46/** @addtogroup bdlar
47 * @{
48 */
49/** @addtogroup bdlar_manipulatorref
50 * @{
51 */
52
53#include <bdlar_fieldinfo.h>
56#include <bdlar_typecategory.h>
57
58
59namespace bdlar {
60
61 // ====================
62 // class ManipulatorRef
63 // ====================
64
66 // DATA
67 const void *d_manipulator_p;
68 const ManipulatorVtable *d_vtable_p;
69
70 // PRIVATE ACCESSORS
71 template <class t_TYPE>
72 int manipulate(t_TYPE *value, bdlat_TypeCategory::DynamicType) const;
73
74 template <class t_TYPE>
75 int manipulate(t_TYPE *value, bdlat_TypeCategory::Array) const;
76
77 template <class t_TYPE>
78 int manipulate(t_TYPE *value, bdlat_TypeCategory::Choice) const;
79
80 template <class t_TYPE>
81 int manipulate(t_TYPE *value, bdlat_TypeCategory::CustomizedType) const;
82
83 template <class t_TYPE>
84 int manipulate(t_TYPE *value, bdlat_TypeCategory::Enumeration) const;
85
86 template <class t_TYPE>
87 int manipulate(t_TYPE *value, bdlat_TypeCategory::NullableValue) const;
88
89 template <class t_TYPE>
90 int manipulate(t_TYPE *value, bdlat_TypeCategory::Sequence) const;
91
92 template <class t_TYPE>
93 int manipulate(t_TYPE *value, bdlat_TypeCategory::Simple) const;
94
95 public:
96 // CREATORS
97 template <class t_MANIPULATOR>
98 explicit ManipulatorRef(t_MANIPULATOR& manipulator);
99
100 // ACCESSORS
101 template <class t_TYPE>
102 int operator()(t_TYPE *value) const;
103};
104
105 // ============================
106 // class ManipulatorWithInfoRef
107 // ============================
108
110 // DATA
111 const void *d_manipulator_p;
112 const ManipulatorWithInfoVtable *d_vtable_p;
113
114 // PRIVATE ACCESSORS
115 template <class t_TYPE>
116 int manipulate(t_TYPE *value,
117 const FieldInfoRef& info,
119
120 template <class t_TYPE>
121 int manipulate(t_TYPE *value,
122 const FieldInfoRef& info,
124
125 template <class t_TYPE>
126 int manipulate(t_TYPE *value,
127 const FieldInfoRef& info,
129
130 template <class t_TYPE>
131 int manipulate(t_TYPE *value,
132 const FieldInfoRef& info,
134
135 template <class t_TYPE>
136 int manipulate(t_TYPE *value,
137 const FieldInfoRef& info,
139
140 template <class t_TYPE>
141 int manipulate(t_TYPE *value,
142 const FieldInfoRef& info,
144
145 template <class t_TYPE>
146 int manipulate(t_TYPE *value,
147 const FieldInfoRef& info,
149
150 template <class t_TYPE>
151 int manipulate(t_TYPE *value,
152 const FieldInfoRef& info,
154
155 public:
156 // CREATORS
157 template <class t_MANIPULATOR>
158 explicit ManipulatorWithInfoRef(t_MANIPULATOR& manipulator);
159
160 // ACCESSORS
161 template <class t_TYPE, class t_INFO>
162 int operator()(t_TYPE *value, const t_INFO& info) const;
163};
164
165// ============================================================================
166// INLINE DEFINITIONS
167// ============================================================================
168
169 // --------------------
170 // class ManipulatorRef
171 // --------------------
172
173// CREATORS
174template <class t_MANIPULATOR>
175inline
176ManipulatorRef::ManipulatorRef(t_MANIPULATOR& manipulator)
177: d_manipulator_p(reinterpret_cast<const void *>(&manipulator))
178, d_vtable_p(ManipulatorVtableUtil::getVtable<t_MANIPULATOR>())
179{
180}
181
182// PRIVATE ACCESSORS
183template <class t_TYPE>
184inline
185int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::DynamicType)
186 const
187{
189 return d_vtable_p->d_manipulateDynamic_fp(d_manipulator_p, &ref);
190}
191
192template <class t_TYPE>
193inline
194int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::Array) const
195{
196 typename FakeDependency<t_TYPE, ArrayRef>::Type ref(*value);
197 return d_vtable_p->d_manipulateArray_fp(d_manipulator_p, &ref);
198}
199
200template <class t_TYPE>
201inline
202int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::Choice) const
203{
205 return d_vtable_p->d_manipulateChoice_fp(d_manipulator_p, &ref);
206}
207
208template <class t_TYPE>
209inline
210int ManipulatorRef::manipulate(t_TYPE *value,
212{
214 return d_vtable_p->d_manipulateCustomized_fp(d_manipulator_p, &ref);
215}
216
217template <class t_TYPE>
218inline
219int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::Enumeration)
220 const
221{
223 return d_vtable_p->d_manipulateEnum_fp(d_manipulator_p, &ref);
224}
225
226template <class t_TYPE>
227inline
228int ManipulatorRef::manipulate(t_TYPE *value,
230{
232 return d_vtable_p->d_manipulateNullable_fp(d_manipulator_p, &ref);
233}
234
235template <class t_TYPE>
236inline
237int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::Sequence)
238 const
239{
241 return d_vtable_p->d_manipulateSequence_fp(d_manipulator_p, &ref);
242}
243
244template <class t_TYPE>
245inline
246int ManipulatorRef::manipulate(t_TYPE *value, bdlat_TypeCategory::Simple) const
247{
249 return d_vtable_p->d_manipulateSimple_fp(d_manipulator_p, &ref);
250}
251
252// ACCESSORS
253template <class t_TYPE>
254inline
255int ManipulatorRef::operator()(t_TYPE *value) const
256{
257 typedef typename SelectCategory<t_TYPE>::Type TypeTag;
258 return manipulate(value, TypeTag());
259}
260
261 // ----------------------------
262 // class ManipulatorWithInfoRef
263 // ----------------------------
264
265// CREATORS
266template <class t_MANIPULATOR>
267inline
269: d_manipulator_p(reinterpret_cast<const void *>(&manipulator))
270, d_vtable_p(ManipulatorVtableUtil::getWithInfoVtable<t_MANIPULATOR>())
271{
272}
273
274// PRIVATE ACCESSORS
275template <class t_TYPE>
276inline
277int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
278 const FieldInfoRef& info,
280{
282 return d_vtable_p->d_manipulateDynamic_fp(d_manipulator_p, &ref, info);
283}
284
285template <class t_TYPE>
286inline
287int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
288 const FieldInfoRef& info,
290{
291 typename FakeDependency<t_TYPE, ArrayRef>::Type ref(*value);
292 return d_vtable_p->d_manipulateArray_fp(d_manipulator_p, &ref, info);
293}
294
295template <class t_TYPE>
296inline
297int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
298 const FieldInfoRef& info,
300{
302 return d_vtable_p->d_manipulateChoice_fp(d_manipulator_p, &ref, info);
303}
304
305template <class t_TYPE>
306inline
307int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
308 const FieldInfoRef& info,
310{
312 return d_vtable_p->d_manipulateCustomized_fp(d_manipulator_p, &ref, info);
313}
314
315template <class t_TYPE>
316inline
317int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
318 const FieldInfoRef& info,
320{
322 return d_vtable_p->d_manipulateEnum_fp(d_manipulator_p, &ref, info);
323}
324
325template <class t_TYPE>
326inline
327int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
328 const FieldInfoRef& info,
330{
332 return d_vtable_p->d_manipulateNullable_fp(d_manipulator_p, &ref, info);
333}
334
335template <class t_TYPE>
336inline
337int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
338 const FieldInfoRef& info,
340{
342 return d_vtable_p->d_manipulateSequence_fp(d_manipulator_p, &ref, info);
343}
344
345template <class t_TYPE>
346inline
347int ManipulatorWithInfoRef::manipulate(t_TYPE *value,
348 const FieldInfoRef& info,
350{
352 return d_vtable_p->d_manipulateSimple_fp(d_manipulator_p, &ref, info);
353}
354
355// ACCESSORS
356template <class t_TYPE, class t_INFO>
357inline
358int ManipulatorWithInfoRef::operator()(t_TYPE *value, const t_INFO& info) const
359{
360 FieldInfoRef infoRef(info);
361 typedef typename SelectCategory<t_TYPE>::Type TypeTag;
362 return manipulate(value, infoRef, TypeTag());
363}
364
365} // close package namespace
366
367
368#endif
369
370// ----------------------------------------------------------------------------
371// Copyright 2024 Bloomberg Finance L.P.
372//
373// Licensed under the Apache License, Version 2.0 (the "License");
374// you may not use this file except in compliance with the License.
375// You may obtain a copy of the License at
376//
377// http://www.apache.org/licenses/LICENSE-2.0
378//
379// Unless required by applicable law or agreed to in writing, software
380// distributed under the License is distributed on an "AS IS" BASIS,
381// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
382// See the License for the specific language governing permissions and
383// limitations under the License.
384// ----------------------------- END-OF-FILE ----------------------------------
385
386/** @} */
387/** @} */
388/** @} */
Definition bdlar_dynamictyperef.h:128
Definition bdlar_fieldinfo.h:102
Definition bdlar_manipulatorref.h:65
ManipulatorRef(t_MANIPULATOR &manipulator)
Definition bdlar_manipulatorref.h:176
int operator()(t_TYPE *value) const
Definition bdlar_manipulatorref.h:255
Definition bdlar_manipulatorvtableutil.h:62
Definition bdlar_manipulatorref.h:109
int operator()(t_TYPE *value, const t_INFO &info) const
Definition bdlar_manipulatorref.h:358
ManipulatorWithInfoRef(t_MANIPULATOR &manipulator)
Definition bdlar_manipulatorref.h:268
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlar_accessorref.h:59
reference_wrapper< T > ref(T &object)
Return a reference wrapper that represents the specified object.
t_TYPE Type
Definition bdlar_typecategory.h:190
Definition bdlar_manipulatorvtable.h:72
ManipulateChoice * d_manipulateChoice_fp
Definition bdlar_manipulatorvtable.h:89
ManipulateNullable * d_manipulateNullable_fp
Definition bdlar_manipulatorvtable.h:92
ManipulateArray * d_manipulateArray_fp
Definition bdlar_manipulatorvtable.h:88
ManipulateEnum * d_manipulateEnum_fp
Definition bdlar_manipulatorvtable.h:91
ManipulateSequence * d_manipulateSequence_fp
Definition bdlar_manipulatorvtable.h:93
ManipulateSimple * d_manipulateSimple_fp
Definition bdlar_manipulatorvtable.h:94
ManipulateDynamic * d_manipulateDynamic_fp
Definition bdlar_manipulatorvtable.h:87
ManipulateCustomized * d_manipulateCustomized_fp
Definition bdlar_manipulatorvtable.h:90
Definition bdlar_manipulatorvtable.h:101
ManipulateSequence * d_manipulateSequence_fp
Definition bdlar_manipulatorvtable.h:135
ManipulateChoice * d_manipulateChoice_fp
Definition bdlar_manipulatorvtable.h:131
ManipulateSimple * d_manipulateSimple_fp
Definition bdlar_manipulatorvtable.h:136
ManipulateEnum * d_manipulateEnum_fp
Definition bdlar_manipulatorvtable.h:133
ManipulateArray * d_manipulateArray_fp
Definition bdlar_manipulatorvtable.h:130
ManipulateDynamic * d_manipulateDynamic_fp
Definition bdlar_manipulatorvtable.h:129
ManipulateCustomized * d_manipulateCustomized_fp
Definition bdlar_manipulatorvtable.h:132
ManipulateNullable * d_manipulateNullable_fp
Definition bdlar_manipulatorvtable.h:134
Definition bdlat_typecategory.h:1037
Definition bdlat_typecategory.h:1038
Definition bdlat_typecategory.h:1039
Definition bdlat_typecategory.h:1036
Definition bdlat_typecategory.h:1040
Definition bdlat_typecategory.h:1041
Definition bdlat_typecategory.h:1042
Definition bdlat_typecategory.h:1043
Definition bslmf_nil.h:133