BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlscm_version.h
Go to the documentation of this file.
1/// @file bdlscm_version.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlscm_version.h -*-C++-*-
8#ifndef INCLUDED_BDLSCM_VERSION
9#define INCLUDED_BDLSCM_VERSION
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bdlscm_version bdlscm_version
15/// @brief Provide source control management (versioning) information.
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlscm
19/// @{
20/// @addtogroup bdlscm_version
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlscm_version-purpose"> Purpose</a>
25/// * <a href="#bdlscm_version-classes"> Classes </a>
26/// * <a href="#bdlscm_version-description"> Description </a>
27/// * <a href="#bdlscm_version-usage"> Usage </a>
28/// * <a href="#bdlscm_version-example-1-embedding-version-information"> Example 1: Embedding Version Information </a>
29/// * <a href="#bdlscm_version-example-2-accessing-the-embedded-version-information"> Example 2: Accessing the Embedded Version information </a>
30///
31/// # Purpose {#bdlscm_version-purpose}
32/// Provide source control management (versioning) information.
33///
34/// # Classes {#bdlscm_version-classes}
35///
36/// - bdlscm::Version: namespace for RCS and SCCS versioning information for `bdl`
37///
38/// # Description {#bdlscm_version-description}
39/// This component provides source control management (versioning)
40/// information for the `bdl` package group. In particular, this component
41/// embeds RCS-style and SCCS-style version strings in binary executable files
42/// that use one or more components from the `bdl` package group. This version
43/// information may be extracted from binary files using common UNIX utilities
44/// (e.g., `ident` and `what`). In addition, the `version` `static` member
45/// function in the `bdlscm::Version` `struct` can be used to query version
46/// information for the `bdl` package group at runtime. The following usage
47/// examples illustrate these two basic capabilities.
48///
49/// Note that unless the `version` method will be called, it is not necessary to
50/// `#include` this component header file to get `bdl` version information
51/// embedded in an executable. It is only necessary to use one or more `bdl`
52/// components (and, hence, link in the `bdl` library).
53///
54/// ## Usage {#bdlscm_version-usage}
55///
56///
57/// This section illustrates intended use of this component.
58///
59/// ### Example 1: Embedding Version Information {#bdlscm_version-example-1-embedding-version-information}
60///
61///
62/// The version of the `bdl` package group linked into a program can be
63/// obtained at runtime using the `version` `static` member function as follows:
64/// @code
65/// #include <bdlscm_version.h>
66///
67/// assert(0 != bdlscm::Version::version());
68///
69/// bsl::cout << "BDL version: " << bdlscm::Version::version()
70/// << bsl::endl;
71/// @endcode
72/// Output similar to the following will be printed to `stdout`:
73/// @code
74/// BDL version: BLP_LIB_BDE_BDL_0.01.0
75/// @endcode
76/// The "0.01.0" portion of the string distinguishes different versions of the
77/// `bdl` package group.
78///
79/// ### Example 2: Accessing the Embedded Version information {#bdlscm_version-example-2-accessing-the-embedded-version-information}
80///
81///
82/// The versioning information embedded into a binary file by this component can
83/// be examined under UNIX using several well-known utilities. For example:
84/// @code
85/// $ ident a.out
86/// a.out:
87/// $Id: BLP_LIB_BDE_BDL_0.01.0 $
88///
89/// $ what a.out | grep BDL
90/// BLP_LIB_BDE_BDL_0.01.0
91///
92/// $ strings a.out | grep BDL
93/// $Id: BLP_LIB_BDE_BDL_0.01.0 $
94/// @(#)BLP_LIB_BDE_BDL_0.01.0
95/// BLP_LIB_BDE_BDL_0.01.0
96/// @endcode
97/// Note that `ident` and `what` typically will display many version strings
98/// unrelated to `bdl` depending on the libraries used by `a.out`.
99/// @}
100/** @} */
101/** @} */
102
103/** @addtogroup bdl
104 * @{
105 */
106/** @addtogroup bdlscm
107 * @{
108 */
109/** @addtogroup bdlscm_version
110 * @{
111 */
112
113#include <bslscm_version.h>
114
115#include <bdlscm_versiontag.h> // 'BDL_VERSION_MAJOR', 'BDL_VERSION_MINOR'
116
117#include <bsls_linkcoercion.h>
118
119
120
121namespace bdlscm {
122
123 // =======
124 // Version
125 // =======
126
127/// This struct provides a namespace for (1) source control management
128/// (versioning) information that is embedded in binary executable files,
129/// and (2) a facility to query that information at runtime.
130struct Version {
131
132 // CLASS DATA
133 static const char *s_ident; // RCS-style version string
134 static const char *s_what; // SCCS-style version string
135
136#define BDLSCM_CONCAT2(a,b,c,d,e,f) a ## b ## c ## d ## e ## f
137#define BDLSCM_CONCAT(a,b,c,d,e,f) BDLSCM_CONCAT2(a,b,c,d,e,f
138
139// 'BDLSCM_D_VERSION' is a symbol whose name warns users of version mismatch
140// linking errors. Note that the exact string "compiled_this_object" must be
141// present in this version coercion symbol. Tools may look for this pattern to
142// warn users of mismatches.
143
144#define BDLSCM_D_VERSION BDLSCM_CONCAT(s_version_BDL_, \
145 BDL_VERSION_MAJOR, _, \
146 BDL_VERSION_MINOR, _, \
147 compiled_this_object)
148
149 static const char *BDLSCM_S_VERSION; // BDE-style version string
150
151 static const char *s_dependencies; // available for future use
152 static const char *s_buildInfo; // available for future use
153 static const char *s_timestamp; // available for future use
154 static const char *s_sourceControlInfo; // available for future use
155
156 // CLASS METHODS
157
158 /// Return the address of a character string that identifies the version
159 /// of the `bdl` package group in use.
160 static const char *version();
161};
162
163// ============================================================================
164// INLINE DEFINITIONS
165// ============================================================================
166
167 // --------------
168 // struct Version
169 // --------------
170
171// CLASS METHODS
172inline
173const char *Version::version()
174{
175 return BDLSCM_S_VERSION;
176}
177
178} // close package namespace
179
181 bdlscm_version_assertion,
183
184
185
186#endif
187
188// ----------------------------------------------------------------------------
189// Copyright 2012 Bloomberg Finance L.P.
190//
191// Licensed under the Apache License, Version 2.0 (the "License");
192// you may not use this file except in compliance with the License.
193// You may obtain a copy of the License at
194//
195// http://www.apache.org/licenses/LICENSE-2.0
196//
197// Unless required by applicable law or agreed to in writing, software
198// distributed under the License is distributed on an "AS IS" BASIS,
199// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200// See the License for the specific language governing permissions and
201// limitations under the License.
202// ----------------------------- END-OF-FILE ----------------------------------
203
204/** @} */
205/** @} */
206/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_LINKCOERCION_FORCE_SYMBOL_DEPENDENCY(type, refName, referredSymbol)
Definition bsls_linkcoercion.h:194
Definition bdlscm_version.h:121
Definition bdlscm_version.h:130
static const char * s_ident
Definition bdlscm_version.h:133
static const char * s_buildInfo
Definition bdlscm_version.h:152
static const char * BDLSCM_S_VERSION
Definition bdlscm_version.h:149
static const char * version()
Definition bdlscm_version.h:173
static const char * s_what
Definition bdlscm_version.h:134
static const char * s_sourceControlInfo
Definition bdlscm_version.h:154
static const char * s_timestamp
Definition bdlscm_version.h:153
static const char * s_dependencies
Definition bdlscm_version.h:151