Data Access Library (DAL)
/home/amesfoort/DAL/dal/dal_version.h
00001 /* Copyright 2011-2012  ASTRON, Netherlands Institute for Radio Astronomy
00002  * This file is part of the Data Access Library (DAL).
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either 
00007  * version 3 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public 
00015  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef DAL_DAL_VERSION_H
00018 #define DAL_DAL_VERSION_H
00019 
00020 #include "dal/hdf5/types/versiontype.h"
00021 #include <string>
00022 #include <cstdio>
00023 #include <hdf5.h>
00024 
00025 namespace dal {
00026 
00030 VersionType version();
00031 
00035 VersionType version_first_release();
00036 
00040 VersionType version_hdf5();
00041 
00045 VersionType version_hdf5_headers_dal();
00046 
00050 inline VersionType version_hdf5_headers_current() {
00051   // this code needs to be in a header file, to let
00052   // the client compiler fill in H5_VERS_* below.
00053   //
00054   // Note: we do not use H5_PACKAGE_VERSION as that might
00055   // include sub-release information that messes up our
00056   // version check systems (i.e. "1.8.4-patch1").
00057 
00058   return VersionType(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
00059 }
00060 
00061 
00066 inline bool check_hdf5_versions() {
00067   // this code needs to be in a header file, to let
00068   // the client compiler fill in H5_PACKAGE_VERSION.
00069 
00070   // client HDF5 header should be the same version as used by DAL
00071   if (version_hdf5_headers_dal() != version_hdf5_headers_current())
00072     return false;
00073 
00074   // client HDF5 library should be the same version as used by DAL
00075   if (version_hdf5_headers_dal() != version_hdf5())
00076     return false;
00077 
00078   // all HDF5 versions used are the same
00079   return true;  
00080 }
00081 
00082 }
00083 
00084 #endif
00085 
 All Classes Functions Variables Typedefs Friends