casa  $Rev:20696$
version.h
Go to the documentation of this file.
00001 //# version.h: Version information for AIPS++
00002 //# Copyright (C) 1996,1997,1999,2000,2001,2002,2004
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef CASA_VERSION_H
00030 #define CASA_VERSION_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 
00035 //# Forward declarations
00036 #include <casa/iosfwd.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 // <summary>
00041 // Version information for AIPS++
00042 // </summary>
00043 
00044 // <use visibility=export>
00045 
00046 // <reviewed reviewer="nkilleen" date="1996/10/24" tests="tversion.cc" demos="">
00047 // </reviewed>
00048 
00049 // <synopsis>
00050 // VersionInfo is a small class that reports information on the  version
00051 // of AIPS++ that an executable was linked with. Normally an application
00052 // programmer won't use this class directly, rather it will be used by
00053 // the ``Tasking'' system which will report this information in a standard
00054 // way.
00055 //
00056 // The available information is:
00057 // <ul>
00058 //    <li> <src>majorVersion()</src>: Major version of AIPS++, changes about twice
00059 //         a year.
00060 //    <li> <src>minorVersion()</src>: Minor version of AIPS++, changes about three
00061 //         times a day. (every exhale).
00062 //    <li> <src>patch()</src>: Patch number of this release. Changes when a
00063 //         bug-fix patch is created.
00064 //    <li> <src>date()</src>: String representation of the date when this
00065 //         release was created (when "exhale" was run).
00066 //    <li> <src>info()</src>: Extra information about this release, e.g.
00067 //         "beta release."
00068 // </ul>
00069 //
00070 // Additionally, there is a <src>report()</src> member function which
00071 // summarizes the above to an <src>ostream</src>.
00072 //
00073 // When released to end users, the minor number is always 0. On the other
00074 // hand, along the development path the patch number is always zero. The
00075 // <src>report()</src> member function takes advantage of this to reformat
00076 // the version information to be more in line with what people are used to.
00077 // For example, 07.247.00 becomes "0.7 (build 247)" and 08.000.5 becomes
00078 // 0.8.5. Note that major version 10 will thus be reported as version
00079 // 1.0
00080 //
00081 // The version information is maintained automatically by "exhale" and
00082 // is made available at link time by the make system.
00083 // </synopsis>
00084 //
00085 // <example>
00086 // If you knew that a format change occurred at release 10.0 you could write
00087 // code like:
00088 // <srcBlock>
00089 // if (VersionInfo::majorVersion() >= 10) {
00090 //    ... process the new way
00091 // } else {
00092 //    ... process the old way
00093 // }
00094 // </srcBlock>
00095 // Of course generally it would be better to provide a conversion program
00096 // for the persistent data, rather than filling applications with tests
00097 // like this.
00098 // </example>
00099 //
00100 // <motivation>
00101 // It is important for bug-reporting and other such purposes to be able
00102 // to uniquely identify the version of AIPS++ that some problem occurs
00103 // in.
00104 // </motivation>
00105 //
00106 // <todo asof="1996/10/24">
00107 // <li> It would be useful to document the compiler/platform as well.
00108 // </todo>
00109 
00110 class VersionInfo
00111 {
00112 public:
00113     // Major version of AIPS++, changes about twice a year.
00114     static int majorVersion();
00115     // Minor version of AIPS++, changes about three times a
00116     // day (every exhale).
00117     static int minorVersion();
00118     // Patch number of this release. Changes when a bug-fix patch is
00119     // created.
00120     static int patch();
00121     // String representation of the date when this release was created
00122     // (when "exhale" was run).
00123     static const char *date();
00124     // Extra information about this release, e.g. "beta release."
00125     static const char *info();
00126     // Summarize the above into an ostream. Note that an 
00127     // <src>ostringstream</src> can be converted to a 
00128     // <linkto class="String">String</linkto> via a constructor.
00129     // This information is NOT prepended with "AIPS++ version:" or anything
00130     // like that. You may wish to add this yourself. The date is also not
00131     // included.
00132     static void report(std::ostream &os);
00133 };
00134 
00135 //# Inlines ------------------------------------------------------------------
00136 inline int VersionInfo::majorVersion()
00137 {
00138     extern const int   aips_major_version;
00139     return aips_major_version;
00140 }
00141 
00142 inline int VersionInfo::minorVersion()
00143 {
00144     extern const int   aips_minor_version;
00145     return aips_minor_version;
00146 }
00147 
00148 inline int VersionInfo::patch()
00149 {
00150     extern const int   aips_patch_version;
00151     return aips_patch_version;
00152 }
00153 
00154 inline const char *VersionInfo::date()
00155 {
00156     extern const char* aips_version_date;
00157     return aips_version_date;
00158 }
00159 
00160 inline const char *VersionInfo::info()
00161 {
00162     extern const char* aips_version_info;
00163     return aips_version_info;
00164 }
00165 
00166 
00167 } //# NAMESPACE CASA - END
00168 
00169 #endif
00170 
00171 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines