BDE 4.39.x Production Release
Loading...
Searching...
No Matches
balber_berencoderoptionsutil.h
Go to the documentation of this file.
1/// @file balber_berencoderoptionsutil.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// balber_berencoderoptionsutil.h -*-C++-*-
8#ifndef INCLUDED_BALBER_BERENCODEROPTIONSUTIL
9#define INCLUDED_BALBER_BERENCODEROPTIONSUTIL
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup balber_berencoderoptionsutil balber_berencoderoptionsutil
15/// @brief Provide a utility for configuring `balber::BerEncoderOptions`.
16/// @addtogroup bal
17/// @{
18/// @addtogroup balber
19/// @{
20/// @addtogroup balber_berencoderoptionsutil
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#balber_berencoderoptionsutil-purpose"> Purpose</a>
25/// * <a href="#balber_berencoderoptionsutil-classes"> Classes </a>
26/// * <a href="#balber_berencoderoptionsutil-description"> Description </a>
27/// * <a href="#balber_berencoderoptionsutil-modes"> Modes </a>
28/// * <a href="#balber_berencoderoptionsutil-usage"> Usage </a>
29/// * <a href="#balber_berencoderoptionsutil-example-1-setting-balber-encoderoptions-for-efficiency"> Example 1: Setting balber::EncoderOptions for Efficiency </a>
30///
31/// # Purpose {#balber_berencoderoptionsutil-purpose}
32/// Provide a utility for configuring `balber::BerEncoderOptions`.
33///
34/// # Classes {#balber_berencoderoptionsutil-classes}
35///
36/// - balber::BerEncoderOptionsUtil: utility for setting `BerEncoderOptions`
37///
38/// @see balber_berencoder, balber_berencoderoptions
39///
40/// # Description {#balber_berencoderoptionsutil-description}
41/// This component provides a `struct` of utility functions,
42/// `balber::BerEncoderOptionsUtil`, for configuring `balber::BerEncoderOptions`
43/// object. In particular, this utility can be used to set the recommended
44/// options needed for encoding BER messages that are time-efficient to decode.
45/// This utility can also be used to set a `balber::BerEncoderOptions` object to
46/// its default state.
47///
48/// ## Modes {#balber_berencoderoptionsutil-modes}
49///
50///
51/// This utility defines the mode `balber::BerEncoderOptionsUtil::e_DEFAULT`
52/// that sets the attributes to the values used in
53/// `balber::BerEncoderOptions()`.
54///
55/// This utility defines the mode
56/// `balber::BerEncoderOptionsUtil::e_FAST_20250615` that applies the default
57/// attribute values except for the following overrides:
58/// @code
59/// encodeDateAndTimeTypesAsBinary true
60/// encodeArrayLengthHints true
61/// @endcode
62/// WARNING: It is only safe to use this mode when communicating with a balber
63/// BER decoder built after June 15, 2025.
64///
65/// ## Usage {#balber_berencoderoptionsutil-usage}
66///
67///
68/// This section illustrates intended use of this component.
69///
70/// ### Example 1: Setting balber::EncoderOptions for Efficiency {#balber_berencoderoptionsutil-example-1-setting-balber-encoderoptions-for-efficiency}
71///
72///
73/// Every call to one of the `encode` functions of `balber::BerEncoder` requires
74/// the user to provide a `balber::BerEncoderOptions` object. The `setMode`
75/// function of this utility provides a convenient way to set the option
76/// attributes to a combination that is deemed efficient for future decoding of
77/// the message.
78///
79/// First, create a `balber::BerEncoderOptions` object:
80/// @code
81/// balber::BerEncoderOptions options;
82/// @endcode
83/// Now, set the option values for efficiency:
84/// @code
85/// balber::BerEncoderOptionsUtil::setMode(
86/// &options,
87/// balber::BerEncoderOptionsUtil::e_FAST_20250615);
88/// @endcode
89/// Finally, `options` can be adjusted to the set of default attributes:
90/// @code
91/// balber::BerEncoderOptionsUtil::setMode(
92/// &options,
93/// balber::BerEncoderOptionsUtil::e_DEFAULT);
94/// @endcode
95/// @}
96/** @} */
97/** @} */
98
99/** @addtogroup bal
100 * @{
101 */
102/** @addtogroup balber
103 * @{
104 */
105/** @addtogroup balber_berencoderoptionsutil
106 * @{
107 */
108
109#include <balscm_version.h>
110
111
112namespace balber {
113
114class BerEncoderOptions;
115
116 // ===========================
117 // class BerEncoderOptionsUtil
118 // ===========================
119
120/// This `struct` provides a namespace for functions that set
121/// `BerEncoderOptions` to particular configurations.
122///
123/// See @ref balber_berencoderoptionsutil
125
126 public:
127 // TYPES
128 enum Mode {
129 e_DEFAULT = 0 // set to default state
130 , e_FAST_20250615 = 1 // set for efficient decoding of encoded data
131 };
132
133 // CLASS METHODS
134
135 /// Set the attributes of the specified `options` to the configuration
136 /// associated with the specified `mode`. See {Modes} for details.
137 static void setMode(BerEncoderOptions *options, Mode mode);
138};
139
140} // close package namespace
141
142
143#endif
144
145// ----------------------------------------------------------------------------
146// Copyright 2025 Bloomberg Finance L.P.
147//
148// Licensed under the Apache License, Version 2.0 (the "License");
149// you may not use this file except in compliance with the License.
150// You may obtain a copy of the License at
151//
152// http://www.apache.org/licenses/LICENSE-2.0
153//
154// Unless required by applicable law or agreed to in writing, software
155// distributed under the License is distributed on an "AS IS" BASIS,
156// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157// See the License for the specific language governing permissions and
158// limitations under the License.
159// ----------------------------- END-OF-FILE ----------------------------------
160
161/** @} */
162/** @} */
163/** @} */
Definition balber_berencoderoptions.h:70
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition balber_berconstants.h:84
Definition balber_berencoderoptionsutil.h:124
Mode
Definition balber_berencoderoptionsutil.h:128
@ e_FAST_20250615
Definition balber_berencoderoptionsutil.h:130
@ e_DEFAULT
Definition balber_berencoderoptionsutil.h:129
static void setMode(BerEncoderOptions *options, Mode mode)