• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

I_Version.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /**************************************************************************
00025 
00026   Version.h
00027 
00028 
00029   **************************************************************************/
00030 
00031 #ifndef _Version_h
00032 #define _Version_h
00033 
00034 struct VersionNumber
00035 {
00036   short int ink_major;          // incompatible change
00037   short int ink_minor;          // minor change, not incompatible
00038 
00039   VersionNumber() {}
00040   VersionNumber(short int major, short int minor) : ink_major(major), ink_minor(minor) {}
00041 };
00042 
00043 inline bool operator < (VersionNumber const& lhs, VersionNumber const& rhs) {
00044   return lhs.ink_major < rhs.ink_major ||
00045     (lhs.ink_major == rhs.ink_major && lhs.ink_minor < rhs.ink_minor)
00046     ;
00047 }
00048 
00049 struct Version
00050 {
00051   VersionNumber cacheDB;
00052   VersionNumber cacheDir;
00053   VersionNumber clustering;
00054   VersionNumber clustering_min;
00055 };
00056 
00057 enum ModuleVersion
00058 { MODULE_VERSION_MIN = 0, MODULE_VERSION_MAX = 2147483647 };
00059 enum ModuleHeaderType
00060 { PUBLIC_MODULE_HEADER, PRIVATE_MODULE_HEADER };
00061 
00062 #define makeModuleVersion(_major_version, _minor_version, _module_type) \
00063 ((ModuleVersion)((((int)_module_type) << 24)   + \
00064                  (((int)_major_version) << 16) + \
00065                  (((int)_minor_version) << 8)))
00066 
00067 #define majorModuleVersion(_v) ((((int)_v) >> 16) & 255)
00068 #define minorModuleVersion(_v) ((((int)_v) >> 8) & 255)
00069 #define moduleVersionType(_v)  ((((int)_v) >> 24) & 127)
00070 
00071 static inline int
00072 checkModuleVersion(ModuleVersion userVersion, ModuleVersion libVersion)
00073 {
00074   if (moduleVersionType(userVersion) == PUBLIC_MODULE_HEADER) {
00075     if ((majorModuleVersion(userVersion) != majorModuleVersion(libVersion)) ||
00076         (minorModuleVersion(userVersion) > minorModuleVersion(libVersion)))
00077       return -1;
00078     return 0;
00079   } else if (moduleVersionType(userVersion) == PRIVATE_MODULE_HEADER) {
00080     if ((majorModuleVersion(userVersion) != majorModuleVersion(libVersion)) ||
00081         (minorModuleVersion(userVersion) != minorModuleVersion(libVersion)))
00082       return -1;
00083     return 0;
00084   } else
00085     return -1;
00086 }
00087 
00088 class AppVersionInfo
00089 {
00090 public:
00091   int defined;
00092   char PkgStr[128];
00093   char AppStr[128];
00094   char VersionStr[128];
00095   char BldNumStr[128];
00096   char BldTimeStr[128];
00097   char BldDateStr[128];
00098   char BldMachineStr[128];
00099   char BldPersonStr[128];
00100   char BldCompileFlagsStr[128];
00101   char FullVersionInfoStr[256];
00102 
00103   AppVersionInfo();
00104   void setup(const char *pkg_name, const char *app_name, const char *app_version,
00105              const char *build_date, const char *build_time, const char *build_machine,
00106              const char *build_person, const char *build_cflags);
00107 };
00108 
00109 #endif /*_Version_h*/

Generated by  doxygen 1.7.1