Skip to content
Commits on Source (15)
*~
build*
### 'Normal' gitignore files.
autom4te.cache
debug.txt
CTestConfig.cmake
myhtml
Vagrantfile
build*
html
doxygen*.tmp
\#*.*\#
*.*~
*.o
*.lo
*.la
myhtml
CMakeLists.txt.user
scan-build
.deps
.libs
*.zip
Makefile
.DS_Store
build-par
build_llvm
.vagrant
Vagrantfile
netcdf-fortran
# blocklist
branches:
except:
- /.*[.]dmh/
- /.*[.]wif/
sudo: required
language: c
services:
......@@ -5,15 +11,15 @@ services:
env:
matrix:
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc CXXOPTS='-DCMAKE_CPP_FLAGS=-fsigned-char' CURHOST=docker-gcc-x64-signed
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang CXXOPTS='-DCMAKE_CPP_FLAGS=-fsigned-char' CURHOST=docker-clang-x64-signed
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc CXXOPTS='-DCMAKE_CPP_FLAGS=-fsigned-char' CURHOST=docker-gcc-x86-signed
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang CXXOPTS='-DCMAKE_CPP_FLAGS=-fsigned-char' CURHOST=docker-clang-x86-signed
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang COPTS='-DCMAKE_C_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=gcc CXXOPTS='-DCMAKE_CPP_FLAGS=-funsigned-char' CURHOST=docker-gcc-x64-unsigned
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE USE_CC=clang CXXOPTS='-DCMAKE_CPP_FLAGS=-funsigned-char' CURHOST=docker-clang-x64-unsigned
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=gcc CXXOPTS='-DCMAKE_CPP_FLAGS=-funsigned-char' CURHOST=docker-gcc-x86-unsigned
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE USE_CC=clang CXXOPTS='-DCMAKE_CPP_FLAGS=-funsigned-char' CURHOST=docker-clang-x86-unsigned
before_install:
- docker pull $DOCKIMG > /dev/null
......
......@@ -24,11 +24,11 @@ set(PACKAGE "netcdf-cxx4" CACHE STRING "")
SET(NCXX_VERSION_MAJOR 4)
SET(NCXX_VERSION_MINOR 3)
SET(NCXX_VERSION_PATCH 0)
SET(NCXX_VERSION_PATCH 1)
SET(NCXX_VERSION_NOTE "")
SET(NCXX_VERSION ${NCXX_VERSION_MAJOR}.${NCXX_VERSION_MINOR}.${NCXX_VERSION_PATCH}${NCXX_VERSION_NOTE})
SET(VERSION ${NCXX_VERSION})
SET(NCXX_LIB_VERSION 1.0.3)
SET(NCXX_LIB_VERSION 1.1.0)
SET(NCXX_SO_VERSION 1)
SET(PACKAGE_VERSION ${VERSION})
......@@ -123,6 +123,21 @@ EXECUTE_PROCESS(
IF(CONFIG_DATE)
string(STRIP ${CONFIG_DATE} CONFIG_DATE)
ENDIF()
# Check to see if we have bash.
FIND_PROGRAM(HAVE_BASH bash)
IF(HAVE_BASH)
STRING(COMPARE EQUAL "${HAVE_BASH}" "C:/Windows/System32/bash.exe" IS_BASH_EXE)
IF(NOT IS_BASH_EXE)
MESSAGE(STATUS "Found bash: ${HAVE_BASH}")
ELSE()
MESSAGE(STATUS "Ignoring ${HAVE_BASH}")
SET(HAVE_BASH "")
ENDIF()
ELSE()
MESSAGE(STATUS "Bash shell not found; disabling shell script tests.")
ENDIF()
##
# Allow for extra dependencies.
##
......@@ -194,6 +209,33 @@ MACRO(add_bin_test prefix F)
ENDIF()
ENDMACRO()
###
# A macro to add a shell test.
###
MACRO(add_sh_test prefix F)
IF(HAVE_BASH)
ADD_TEST(${prefix}_${F} bash "-c" "export srcdir=${CMAKE_CURRENT_SOURCE_DIR};export TOPSRCDIR=${CMAKE_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}/${F}.sh")
ENDIF()
ENDMACRO()
# Build a binary used by a script, but don't make a test out of it.
MACRO(build_bin_test F)
ADD_EXECUTABLE(${F} ${F}.cpp)
TARGET_LINK_LIBRARIES(${F} netcdf-cxx4 ${ALL_TLL_LIBS})
IF(MSVC)
SET_TARGET_PROPERTIES(${F}
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
)
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
ENDMACRO()
################################
# End Utility Macros
################################
......@@ -262,7 +304,7 @@ OPTION(NCXX_ENABLE_TESTS "Enable tests. Run with 'make test'." ON)
IF(NCXX_ENABLE_TESTS)
# Options for CTest-based tests, dashboards.
SET(NCXX_CTEST_PROJECT_NAME "netcdf-cxx4" CACHE STRING "Project Name for CTest-based testing purposes.")
SET(NCXX_CTEST_DROP_SITE "my.cdash.org" CACHE STRING "Dashboard location for CTest-based testing purposes.")
SET(NCXX_CTEST_DROP_SITE "cdash.unidata.ucar.edu" CACHE STRING "Dashboard location for CTest-based testing purposes.")
SET(NCXX_CTEST_DROP_LOC_PREFIX "" CACHE STRING "Prefix for Dashboard location on remote server when using CTest-based testing.")
FIND_PROGRAM(HOSTNAME_CMD NAMES hostname)
......@@ -303,6 +345,10 @@ MARK_AS_ADVANCED(NCXX_CTEST_PROJECT_NAME
# Seek out dependent libraries.
################################
###
# Find NetCDF
###
IF(NOT netCDF_LIBRARIES AND NOT netCDF_INCLUDE_DIR)
FIND_PACKAGE(netCDF QUIET)
ELSE()
......@@ -311,7 +357,6 @@ ENDIF()
IF (netCDF_FOUND)
INCLUDE_DIRECTORIES(SYSTEM ${netCDF_INCLUDE_DIR})
LINK_DIRECTORIES(${netCDF_LIB_DIR})
SET(NETCDF_C_LIBRARY ${netCDF_LIBRARIES})
SET(NETCDF_C_INCLUDE_DIR ${netCDF_INCLUDE_DIR})
ELSE()
......@@ -326,7 +371,6 @@ ELSE()
MESSAGE(FATAL_ERROR "Directory containing netcdf.h cannot be found. Please reinstall and try again.")
ELSE()
GET_FILENAME_COMPONENT(netCDF_LIB_DIR "${NETCDF_C_LIBRARY}" REALPATH)
LINK_DIRECTORIES(${netCDF_LIB_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${NC_H_INCLUDE_DIR})
ENDIF()
ENDIF()
......@@ -340,6 +384,30 @@ IF(NC_IS_PARALLEL)
SET(BUILD_PARALLEL ${NC_IS_PARALLEL} CACHE STRING "")
ENDIF()
###
# Check to see if netcdf-c was built with plugin support.
###
CHECK_LIBRARY_EXISTS(${NETCDF_C_LIBRARY} nc_def_var_filter "" NC_HAS_DEF_VAR_FILTER)
IF(NC_HAS_DEF_VAR_FILTER)
SET(HAS_DEF_VAR_FILTER ${NC_HAS_DEF_VAR_FILTER} CACHE STRING "")
ENDIF(NC_HAS_DEF_VAR_FILTER)
###
# Find HDF5
###
IF(MSVC)
SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL NO_MODULES REQUIRED ${NC_HDF5_LINK_TYPE})
ELSE(MSVC)
FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
ENDIF(MSVC)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY)
IF(NOT HAVE_H5FREE_MEMORY)
MESSAGE(STATUS "Plugin support requires libhdf5 with H5Free support. Your libhdf5 install does not provide H5Free. Please install a newer version of libhdf5 if you require plugin compression support.")
SET(NC_HAS_DEF_VAR_FILTER "")
ENDIF()
################################
# End 'seek out dependent libraries'
################################
......@@ -509,6 +577,33 @@ INSTALL(
# End libnetcdf-cxx.settings section.
#####
#####
# Begin ncxx4-config section
#####
FILE(MAKE_DIRECTORY ${NCXX_BINARY_DIR}/tmp)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ncxx4-config.cmake.in"
"${NCXX_BINARY_DIR}/tmp/ncxx4-config" @ONLY)
FILE(COPY "${NCXX_BINARY_DIR}/tmp/ncxx4-config"
DESTINATION ${NCXX_BINARY_DIR}/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
INSTALL(PROGRAMS ${NCXX_BINARY_DIR}/ncxx4-config
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT utilities)
#####
# End ncxx4-config section
#####
#####
# Build test_common.sh
#####
SET(EXTRA_DIST ${EXTRA_DIST} ${CMAKE_SOURCE_DIR}/test_common.in)
SET(TOPSRCDIR "${CMAKE_SOURCE_DIR}")
SET(TOPBUILDDIR "${CMAKE_BINARY_DIR}")
configure_file(${CMAKE_SOURCE_DIR}/test_common.in ${CMAKE_BINARY_DIR}/test_common.sh @ONLY NEWLINE_STYLE LF)
#####
# Options
#####
......@@ -534,6 +629,8 @@ install(
# Traverse into subdirectories.
#####
##
# Set up include directories.
##
......@@ -541,10 +638,24 @@ INCLUDE_DIRECTORIES(cxx4 examples)
ADD_SUBDIRECTORY(cxx4)
ADD_SUBDIRECTORY(examples)
IF(NC_HAS_DEF_VAR_FILTER)
#####
# Build cxx4/findplugin.sh
#####
SET(ISCMAKE "1")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cxx4/findplugin.in ${CMAKE_BINARY_DIR}/cxx4/findplugin.sh @ONLY NEWLINE_STYLE LF)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/examples/findplugin.in ${CMAKE_BINARY_DIR}/examples/findplugin.sh @ONLY NEWLINE_STYLE LF)
ADD_SUBDIRECTORY(plugins)
ENDIF(NC_HAS_DEF_VAR_FILTER)
IF(ENABLE_DOXYGEN)
ADD_SUBDIRECTORY(docs)
ENDIF()
##
# CPack, CMakeInstallation.cmake file.
##
......
# This is the main automake file for the netCDF CXX4 C++ library.
# These files get added to the distribution.
EXTRA_DIST = COPYRIGHT ncxx4-config.in
# Directory for autotools to put scripts during build.
ACLOCAL_AMFLAGS = -I m4
......@@ -16,6 +13,19 @@ bin_SCRIPTS = ncxx4-config
# Build and test in these directories.
SUBDIRS = cxx4 examples docs
if ENABLE_FILTER_TESTING
SUBDIRS += plugins
endif
# These files get added to the distribution.
EXTRA_DIST = CMakeLists.txt README.md CTestCustom.cmake \
cxx4/CMakeLists.txt docs/CMakeLists.txt \
examples/CMakeLists.txt plugins/CMakeLists.txt test_common.in \
ncxx4-config.in netcdf-cxx4.pc.in RELEASE_NOTES.md \
ncxx4-config.cmake.in libnetcdf-cxx.settings.in \
CMakeInstallation.cmake COPYRIGHT cmake_uninstall.cmake.in \
CTestConfig.cmake.in
# Remove these generated files, for a distclean.
DISTCLEANFILES = VERSION
......
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -18,7 +18,17 @@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
......@@ -82,12 +92,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
@ENABLE_FILTER_TESTING_TRUE@am__append_1 = plugins
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in $(srcdir)/ncxx4-config.in \
$(srcdir)/netcdf-cxx4.pc.in compile config.guess config.sub \
install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
......@@ -95,11 +101,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = ncxx4-config netcdf-cxx4.pc
CONFIG_CLEAN_FILES = test_common.sh ncxx4-config netcdf-cxx4.pc
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
......@@ -165,7 +173,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
......@@ -187,7 +195,11 @@ am__define_uniq_tagged_files = \
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = cxx4 examples docs plugins
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/ncxx4-config.in $(srcdir)/netcdf-cxx4.pc.in \
$(srcdir)/test_common.in compile config.guess config.sub \
install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
......@@ -262,6 +274,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_FILTER_TESTING = @ENABLE_FILTER_TESTING@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
......@@ -274,6 +287,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
ISCMAKE = @ISCMAKE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
......@@ -282,10 +296,14 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MSVC = @MSVC@
NCCONF = @NCCONF@
NC_HAS_FILTERS = @NC_HAS_FILTERS@
NC_LIBS = @NC_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
......@@ -352,6 +370,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......@@ -365,9 +384,6 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# These files get added to the distribution.
EXTRA_DIST = COPYRIGHT ncxx4-config.in
# Directory for autotools to put scripts during build.
ACLOCAL_AMFLAGS = -I m4
......@@ -379,7 +395,17 @@ pkgconfig_DATA = netcdf-cxx4.pc
bin_SCRIPTS = ncxx4-config
# Build and test in these directories.
SUBDIRS = cxx4 examples docs
SUBDIRS = cxx4 examples docs $(am__append_1)
# These files get added to the distribution.
EXTRA_DIST = CMakeLists.txt README.md CTestCustom.cmake \
cxx4/CMakeLists.txt docs/CMakeLists.txt \
examples/CMakeLists.txt plugins/CMakeLists.txt test_common.in \
ncxx4-config.in netcdf-cxx4.pc.in RELEASE_NOTES.md \
ncxx4-config.cmake.in libnetcdf-cxx.settings.in \
CMakeInstallation.cmake COPYRIGHT cmake_uninstall.cmake.in \
CTestConfig.cmake.in
# Remove these generated files, for a distclean.
DISTCLEANFILES = VERSION
......@@ -402,15 +428,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
......@@ -436,6 +461,8 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
test_common.sh: $(top_builddir)/config.status $(srcdir)/test_common.in
cd $(top_builddir) && $(SHELL) ./config.status $@
ncxx4-config: $(top_builddir)/config.status $(srcdir)/ncxx4-config.in
cd $(top_builddir) && $(SHELL) ./config.status $@
netcdf-cxx4.pc: $(top_builddir)/config.status $(srcdir)/netcdf-cxx4.pc.in
......@@ -612,7 +639,10 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
......@@ -677,7 +707,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
......@@ -693,17 +723,17 @@ dist-xz: distdir
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
......@@ -720,7 +750,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
......@@ -730,23 +760,23 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
......@@ -930,6 +960,8 @@ uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-binSCRIPTS uninstall-pkgconfigDATA
.PRECIOUS: Makefile
install-data-hook:
@echo ''
......
......@@ -7,19 +7,18 @@ Official GitHub repository for netCDF-4 C++ library.
Note: The latest release of the historic C++ libraries, netCDF-4.2, may be downloaded from the following page:
* http://www.unidata.ucar.edu/downloads/netcdf/index.jsp
* https://www.unidata.ucar.edu/downloads/netcdf/index.jsp
### Introduction
Lynton Appel, of the Culham Centre for Fusion Energy (CCFE) in
Oxfordshire, has developed and contributed a
Oxfordshire, has developed and contributed a
[netCDF-4 C++ library][netcdf-cxx4] that depends on an installed
netCDF-4 C library. The netCDF-4 C++ API was developed for use in
managing fusion research data from CCFE's innovative MAST (Mega Amp
Spherical Tokamak) experiment.
[netcdf-cxx4]: http://www.unidata.ucar.edu/downloads/netcdf/netcdf-cxx/
[netcdf-cxx4]: https://www.unidata.ucar.edu/downloads/netcdf/netcdf-cxx/
Appel's C++ implementation is a complete read/write interface for
netCDF-4, but can also be used as an alternative to the older netCDF-3
......@@ -46,20 +45,42 @@ and should be directed to [Lynton Appel][la_email].
### Installation
Installing the C++ interface requires the additional flag
--enable-netcdf-4 to be used during the configure stage of the
installation, for example enter
The C++ interface requires the C library to have been build with the
netCDF-4 API (this is the default in recent versions). You can check
by running:
$ nc-config --has-nc4
yes
The simplest way to build the C++ interface is with CMake:
mkdir build
cd build
cmake ..
make
ctest
make install
Make sure that either `nc-config` is in your `PATH`, or that the
location of `netCDFConfig.cmake` is in `CMAKE_PREFIX_PATH`.
There is also an autotools-based build system:
./configure --enable-cxx-4 [plus other options]
mkdir build
cd build
../configure
make
make check
make install
Note that the "configure" script must be generated using
autoreconf -if
autoreconf -if
To build the C++ interface guide, change to the cxx4 directory of the
distribution and enter
doxygen
doxygen
By default, HTML documentation will be installed in cxx4/doc/html;
other options may be specified according to the settings contained in
......@@ -69,10 +90,92 @@ documentation, the system will need to have doxygen and
[Graphviz][g_l] installed.
[dox_l]: http://www.stack.nl/~dimitri/doxygen
[g_l]: http://www.graphviz.org/
[dox_l]: https://www.stack.nl/~dimitri/doxygen
[g_l]: https://www.graphviz.org/
### Examples of usage
Examples codes can be found by selecting the "Examples" tab.
Here is an example of writing a 2D array to a file, and then reading
it back in:
```cpp
#include <iostream>
#include <netcdf>
// We are writing 2D data, a 6 x 12 grid
constexpr int nx = 6;
constexpr int ny = 12;
// Return this in event of a problem
constexpr int nc_err = 2;
int main() {
// The default behavior of the C++ API is to throw an exception if
// an error occurs
try {
// This is the data array we will write. It will just be filled
// with a progression of numbers for this example.
int dataOut[nx][ny];
// Create some pretend data. If this wasn't an example program, we
// would have some real data to write, for example, model output.
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
dataOut[i][j] = i * ny + j;
}
}
// Create the file. The Replace parameter tells netCDF to overwrite
// this file, if it already exists.
netCDF::NcFile dataFile("simple_xy.nc", netCDF::NcFile::replace);
// Create netCDF dimensions
auto xDim = dataFile.addDim("x", nx);
auto yDim = dataFile.addDim("y", ny);
// Define the variable. The type of the variable in this case is
// ncInt (32-bit integer)
auto data = dataFile.addVar("data", netCDF::ncInt, {xDim, yDim});
// Write the data to the file. Although netCDF supports reading
// and writing subsets of data, in this case we write all the data
// in one operation.
data.putVar(dataOut);
// The file will be automatically close when the NcFile object goes
// out of scope. This frees up any internal netCDF resources
// associated with the file, and flushes any buffers.
} catch (netCDF::exceptions::NcException &e) {
std::cout << e.what() << std::endl;
return nc_err;
}
// Now read the data back in
try {
// This is the array we will read into
int dataIn[nx][ny];
// Open the file for read access
netCDF::NcFile dataFile("simple_xy.nc", netCDF::NcFile::read);
// Retrieve the variable named "data"
auto data = dataFile.getVar("data");
if (data.isNull())
return nc_err;
data.getVar(dataIn);
// Check the values.
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
if (dataIn[i][j] != i * ny + j) {
return nc_err;
}
}
}
} catch (netCDF::exceptions::NcException &e) {
std::cout << e.what() << std::endl;
return nc_err;
}
}
```
......@@ -6,9 +6,26 @@ This file contains a high-level description of this package's evolution. Release
Note that this file was created and maintained starting with the `netcdf-cxx4 4.3.0 release`.
## netCDF-CXX4 4.3.2 TBD
## netCDF-CXX4 v4.3.1 September 12, 2019
### Requirements
* netCDF-C 4.6.0 or greater
### Changes
* [Enhancement] Added cmake support to distribution files created by `make dist`.
* [Bug Fix] Added `ncFile::create()`, also added a new `open` function and constructor to allow for more flexibility when opening a file. See [GitHub #55](https://github.com/Unidata/netcdf-cxx4/issues/55) for more information.
* [Enhancement] Addressed an issue reported with `Intel Compilers 17.0.0`. See [GitHub #41](https://github.com/Unidata/netcdf-cxx4/issues/41) for more information.
* [Enhancement] Updated how `configure` determines information about the existing netCDF-C install. See [GitHub pull request #39](https://github.com/Unidata/netcdf-cxx4/pull/39) for more information.
* Corrected an issue where cmake-based builds weren't generating `ncxx4-config`. See [GitHub pull request #37](https://github.com/Unidata/netcdf-cxx4/pull/37) for more information.
## netcdf-cxx4 v4.3.0 released May 13, 2016
* Fixed an issue where the tests were failing silently, and the underlying `NcType` class could not properly determine the type name or type size reliably. [GitHub issue #30](See https://github.com/Unidata/netcdf-cxx4/issues/30) for more information.
* Fixed an issue where the tests were failing silently, and the underlying `NcType` class could not properly determine the type name or type size reliably. See [GitHub issue #30](https://github.com/Unidata/netcdf-cxx4/issues/30) for more information.
* Changed `NCXX_ENABLE_DOXYGEN` option to an easier-to-remember `ENABLE_DOXYGEN`.
* Added `--enable-doxygen`, `-DNCXX_ENABLE_DOXYGEN=ON` options to allow generation of netCDF-CXX4 documentation via doxygen using either `configure` or `cmake`, respectively.
* Added `netcdf-cxx4` to the [Coverity Scan Dashboard](https://scan.coverity.com/projects/unidata-netcdf-cxx4?tab=overview).
......
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.14'
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.14.1], [],
m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
......@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.14.1])dnl
[AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -103,15 +103,14 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -142,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -333,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
......@@ -347,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
# TODO: see whether this extra hack can be removed once we start
# requiring Autoconf 2.70 or later.
AS_CASE([$CONFIG_FILES],
[*\'*], [eval set x "$CONFIG_FILES"],
[*], [set x $CONFIG_FILES])
shift
for mf
# Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile which includes
# dependency-tracking related rules and includes.
# Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|| continue
am_dirpart=`AS_DIRNAME(["$am_mf"])`
am_filepart=`AS_BASENAME(["$am_mf"])`
AM_RUN_LOG([cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles]) || am_rc=$?
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
AS_UNSET([am_dirpart])
AS_UNSET([am_filepart])
AS_UNSET([am_mf])
AS_UNSET([am_rc])
rm -f conftest-deps.mk
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
......@@ -398,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
# This code is only required when automatic dependency tracking is enabled.
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
# order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
[AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -496,11 +485,11 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
......@@ -564,7 +553,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
......@@ -573,7 +562,11 @@ to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi])
fi
dnl The trailing newline in this macro's definition is deliberate, for
dnl backward compatibility and to allow trailing 'dnl'-style comments
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
......@@ -602,7 +595,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -613,7 +606,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
......@@ -623,7 +616,7 @@ if test x"${install_sh}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -645,7 +638,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -680,7 +673,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -688,49 +681,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
# Check whether make has an 'include' directive that can support all
# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
cat > confinc.mk << 'END'
am__doit:
@echo this is the am__doit target
@echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# BSD make does it like this.
echo '.include "confinc.mk" # ignored' > confmf.BSD
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
echo 'include confinc.mk # ignored' > confmf.GNU
_am_result=no
for s in GNU BSD; do
AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
AS_CASE([$?:`cat confinc.out 2>/dev/null`],
['0:this is the am__doit target'],
[AS_CASE([$s],
[BSD], [am__include='.include' am__quote='"'],
[am__include='include' am__quote=''])])
if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
fi
done
rm -f confinc.* confmf.*
AC_MSG_RESULT([${_am_result}])
AC_SUBST([am__include])])
AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -769,7 +755,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -798,7 +784,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -845,7 +831,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -864,7 +850,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -945,7 +931,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1005,7 +991,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1033,7 +1019,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1052,7 +1038,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
......@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
......@@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
......@@ -339,9 +340,9 @@ exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
This diff is collapsed.
......@@ -70,8 +70,7 @@
/* do large file tests */
#undef LARGE_FILE_TESTS
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
# the COPYRIGHT file for more information.
AC_PREREQ([2.66])
AC_INIT([netCDF-cxx4], [4.3.0], [support-netcdf@unidata.ucar.edu])
AC_INIT([netCDF-cxx4], [4.3.1], [support-netcdf@unidata.ucar.edu])
# Create the VERSION file, which contains the package version from
# AC_INIT.
......@@ -43,6 +43,7 @@ if test "x$enable_extra_tests" = xyes; then
fi
AM_CONDITIONAL(EXTRA_TESTS, [test x$enable_extra_tests = xyes])
# Does the user want to run tests for large files (> 2GiB)?
AC_MSG_CHECKING([whether large file (> 2GB) tests should be run])
AC_ARG_ENABLE([large-file-tests],
......@@ -175,32 +176,92 @@ AC_FUNC_MALLOC
# Check to see if any macros must be set to enable large (>2GB) files.
AC_SYS_LARGEFILE
# See if these functions are in the library.
AC_CHECK_HEADERS([netcdf.h], [], [AC_MSG_ERROR([netcdf.h could not be found. Please set CPPFLAGS.])])
AC_SEARCH_LIBS([nc_create], [netcdf], [], [])
AC_CHECK_FUNCS([nc_def_opaque nccreate nc_set_log_level oc_open nc_use_parallel_enabled])
test "x$ac_cv_func_oc_open" = xyes && nc_has_dap=yes || nc_has_dap=no
# Whether we build/test some functionality depends on what we found in
# the C library.
nc_build_v2=$ac_cv_func_nccreate
nc_build_v4=$ac_cv_func_nc_def_opaque
if test "x$nc_build_v4" = xyes; then
AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4])
else
AC_ERROR([NetCDF must be built with netCDF-4 enabled.])
# User supplied nc-config
AC_ARG_WITH([nc-config],
[AS_HELP_STRING([--with-nc-config=DIR],
[directory containing nc-config (if not in PATH)])],,
[])
# Find nc-config, either from user supplied PATH, or system PATH
AS_CASE([$with_nc_config],
["yes"], [AC_MSG_ERROR([You must supply a path to --with-nc-config])],
["no"], [AC_MSG_NOTICE([Not using nc-config])],
[AC_PATH_PROG([NCCONF], [nc-config], [], [$with_nc_config$PATH_SEPARATOR$PATH])])
# If we found nc-config, use that to check NetCDF capabilities
# otherwise, try and find the header/libraries and check directly
AS_IF([test "x$ac_cv_path_NCCONF" != "x"],
[
AC_MSG_NOTICE([checking output of nc-config])
nc_build_v2=`$ac_cv_path_NCCONF --has-nc2`
nc_build_v4=`$ac_cv_path_NCCONF --has-nc4`
nc_has_logging=`$ac_cv_path_NCCONF --has-logging`
nc_has_dap=`$ac_cv_path_NCCONF --has-dap`
nc_has_pnetcdf=`$ac_cv_path_NCCONF --has-pnetcdf`
],
[
# See if these functions are in the library.
AC_CHECK_HEADERS([netcdf.h], [], [AC_MSG_ERROR([netcdf.h could not be found. Please set CPPFLAGS.])])
AC_SEARCH_LIBS([nc_create], [netcdf], [], [])
AC_CHECK_FUNCS([nc_def_opaque nccreate nc_set_log_level oc_open nc_use_parallel_enabled])
# Whether we build/test some functionality depends on what we found in
# the C library.
nc_build_v2=$ac_cv_func_nccreate
nc_build_v4=$ac_cv_func_nc_def_opaque
nc_has_logging=$ac_cv_func_nc_set_log_level
nc_has_dap=$ac_cv_func_oc_open
nc_has_pnetcdf=$ac_cv_func_nc_use_parallel_enabled
])
###
# Check for Filter support
###
AC_CHECK_LIB([netcdf],[nc_def_var_filter],[nc_has_filters=yes],[nc_has_filters=no])
if test "x$nc_has_filters" != xno; then
# Do we want to run
AC_MSG_CHECKING([whether filter testing should be run])
AC_ARG_ENABLE([filter-testing],
[AS_HELP_STRING([--disable-filter-testing],
[Do not run filter test and example; requires shared libraries and netCDF-4])])
test "x$enable_filter_testing" = xno || enable_filter_testing=yes
AC_MSG_RESULT($enable_filter_testing)
fi
AM_CONDITIONAL(ENABLE_FILTER_TESTING, [test x$enable_filter_testing = xyes])
AC_MSG_CHECKING([netCDF v2 API present])
AC_MSG_RESULT([$nc_build_v2])
AC_MSG_CHECKING([netCDF-4 present])
AC_MSG_RESULT([$nc_build_v4])
AM_CONDITIONAL([USE_NETCDF4], [test "x$ac_cv_func_nc_def_opaque" = xyes])
AM_CONDITIONAL([BUILD_V2], [test "x$ac_cv_func_nccreate" = xyes])
AM_CONDITIONAL([USE_LOGGING], [test "x$ac_cv_func_nc_set_log_level" = xyes])
AM_CONDITIONAL([BUILD_DAP], [test "x$ac_cv_func_oc_open" = xyes])
AM_CONDITIONAL([BUILD_PARALLEL], [test "x$ac_cv_func_nc_use_parallel_enabled" = xyes])
AC_MSG_CHECKING([netCDF has logging])
AC_MSG_RESULT([$nc_has_logging])
AC_MSG_CHECKING([netCDF has dap])
AC_MSG_RESULT([$nc_has_dap])
AC_MSG_CHECKING([netCDF has pnetcdf])
AC_MSG_RESULT([$nc_has_pnetcdf])
AC_MSG_CHECKING([netCDF has filter support])
AC_MSG_RESULT([$nc_has_filters])
if test "x$nc_build_v4" = xyes; then
AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4])
else
AC_ERROR([NetCDF must be built with netCDF-4 enabled.])
fi
AM_CONDITIONAL([USE_NETCDF4], [test "x$nc_build_v4" = xyes])
AM_CONDITIONAL([BUILD_V2], [test "x$nc_build_v2" = xyes])
AM_CONDITIONAL([USE_LOGGING], [test "x$nc_has_logging" = xyes])
AM_CONDITIONAL([BUILD_DAP], [test "x$nc_has_dap" = xyes])
AM_CONDITIONAL([BUILD_PARALLEL], [test "x$nc_has_pnetcdf" = xyes])
AM_CONDITIONAL([NC_HAS_FILTERS], [test "x$nc_has_filters" = xyes])
AM_CONDITIONAL([BUILD_DOCS], [test x$enable_doxygen = xyes])
AM_CONDITIONAL(USE_VALGRIND_TESTS, [test "x$enable_valgrind_tests" = xyes])
......@@ -232,8 +293,16 @@ AC_SUBST(NC_LIBS,[$NC_LIBS])
AC_SUBST(HAS_DAP,[$nc_has_dap])
AC_SUBST(HAS_NC2,[$nc_build_v2])
AC_SUBST(HAS_NC4,[$nc_build_v4])
AC_SUBST(NC_HAS_FILTERS, [$nc_has_filters])
AC_SUBST(ENABLE_FILTER_TESTING, [$enable_filter_testing])
# This would be true for a cmake build.
AC_SUBST([ISCMAKE], [])
# This would be true for a visual studio build.
AC_SUBST([MSVC], [])
AC_MSG_NOTICE([generating header files and makefiles])
AC_CONFIG_FILES(test_common.sh:test_common.in)
AC_CONFIG_FILES([Makefile
cxx4/Makefile
examples/Makefile
......@@ -242,4 +311,17 @@ AC_CONFIG_FILES([Makefile
netcdf-cxx4.pc],
[test -f ncxx4-config && chmod 755 ncxx4-config ])
if test "x$nc_has_filters" = xyes; then
AC_CONFIG_FILES(cxx4/findplugin.sh:cxx4/findplugin.in)
if test "x$enable_filter_testing" != xno; then
AC_CONFIG_FILES(plugins/Makefile)
AC_CONFIG_FILES([examples/tst_filter.sh:examples/tst_filter.sh], [chmod ugo+x examples/tst_filter.sh])
AC_CONFIG_FILES(examples/findplugin.sh:examples/findplugin.in)
fi
fi
AC_OUTPUT()
......@@ -22,12 +22,18 @@ IF(NCXX_ENABLE_TESTS)
add_bin_test(cxx4 test_var2)
add_bin_test(cxx4 test_type)
add_bin_test(cxx4 test_open_close)
add_bin_test(cxx4 test_ncFile_Flags)
add_bin_test(cxx4 test_filter)
ENDIF()
SET(ALL_TLL_LIBS ${NETCDF_C_LIBRARY})
SET(ALL_TLL_LIBS ${ALL_TLL_LIBS} ${HDF5_C_LIBRARY_hdf5})
SET(ALL_TLL_LIBS ${ALL_TLL_LIBS} ${EXTRA_DEPS} PARENT_SCOPE)
ADD_LIBRARY(netcdf-cxx4 ${CXX_SOURCES})
TARGET_INCLUDE_DIRECTORIES(netcdf-cxx4 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
TARGET_LINK_LIBRARIES(netcdf-cxx4 ${NETCDF_C_LIBRARY} ${EXTRA_DEPS})
TARGET_LINK_LIBRARIES(netcdf-cxx4 ${ALL_TLL_LIBS})
SET_TARGET_PROPERTIES(netcdf-cxx4 PROPERTIES
VERSION ${NCXX_LIB_VERSION}
SOVERSION ${NCXX_SO_VERSION}
......@@ -43,5 +49,7 @@ INSTALL(
)
INSTALL(
TARGETS netcdf-cxx4
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
......@@ -11,7 +11,7 @@ lib_LTLIBRARIES = libnetcdf_c++4.la
# For rules updating the version info, see
# http://www.gnu.org/s/libtool/manual/html_node/Updating-version-info.html
libnetcdf_c__4_la_LDFLAGS = -version-info 1:3:0
libnetcdf_c__4_la_LDFLAGS = -version-info 2:0:1 -no-undefined
# These headers will be installed in the users header directory.
include_HEADERS = netcdf ncAtt.h ncCheck.h ncDim.h ncException.h \
......@@ -31,7 +31,8 @@ ncUint64.cpp ncString.cpp
# These are the tests.
TESTFILES = test_classic$(EXEEXT) test_group$(EXEEXT) \
test_dim$(EXEEXT) test_att$(EXEEXT) test_var$(EXEEXT) \
test_var2$(EXEEXT) test_type$(EXEEXT) test_open_close$(EXEEXT)
test_var2$(EXEEXT) test_type$(EXEEXT) test_open_close$(EXEEXT) \
test_ncFile_Flags$(EXEEXT)
test_classic_SOURCES = test_classic.cpp
test_group_SOURCES = test_group.cpp
......@@ -41,6 +42,8 @@ test_var_SOURCES = test_var.cpp test_utilities.h
test_var2_SOURCES = test_var2.cpp test_utilities.h
test_type_SOURCES = test_type.cpp test_utilities.h
test_open_close_SOURCES = test_open_close.cpp test_utilities.h
test_ncFile_Flags_SOURCES = test_ncFile_Flags.cpp test_utilities.h
# Build and run these tests.
check_PROGRAMS = $(TESTFILES)
......@@ -48,6 +51,8 @@ TESTS = $(TESTFILES)
CLEANFILES = firstFile.cdf test*.nc
EXTRA_DIST = test_filter.cpp
# Empty file that gets time-stamped after docs are generated
doxygen_stamp: $(libnetcdf_c__4_la_SOURCES) $(include_HEADERS)
doxygen
......
This diff is collapsed.
#!/bin/bash
# Define a function that attempts to locate a
# plugin with a given canonical name.
# Assumptions:
# 1. plugins is a top-level directory
# Inputs:
# $1 is the canonical name
# $2 is 1 if we are running under cmake
# $3 is 1 if we are running using Visual Studio, blank otherwise
# $4 is the build type; only used if $3 is 1
# Outputs:
# return code is 0 is success, 1 if failed
# Variable HDF5_PLUGIN_LIB is set to the library file name
# Variable HDF5_PLUGIN_PATH is setthe absolute path to the
# directory containing the plugin library file
# Local variables are prefixed with FP_
#
# Note: we assume that the use of the CMAKE_BUILD_TYPE
# is obviated by setting the LIBRARY_OUTPUT_DIRECTORY
# variables: see hdf5plugins/CMakeLists.txt
findplugin() {
FP_NAME="$1"
# Figure out the compiler (some values from ./configure)
FP_ISCMAKE=@ISCMAKE@
FP_ISMSVC=@MSVC@
# And topsrcdir
topbuilddir='@abs_top_builddir@'
# Are we operating under OS-X? (test using uname)
FP_OS=`uname | cut -d '_' -f 1`
if test "x$FP_OS" = xDarwin ; then FP_ISOSX=1; fi
# Are we operating under CYGWIN? (test using uname)
FP_OS=`uname | cut -d '_' -f 1`
if test "x$FP_OS" = xCYGWIN ; then FP_ISCYGWIN=1; fi
FP_PLUGINS="$topbuilddir/plugins"
FP_PLUGIN_LIB=
FP_PLUGIN_PATH=
# Figure out the plugin file name
# Test for visual studio before cygwin since both might be true
if test "x$FP_ISMSVC" != x ; then
FP_PLUGIN_LIB="${FP_NAME}.dll"
elif test "x$FP_ISCYGWIN" != x ; then
FP_PLUGIN_LIB="cyg${FP_NAME}.dll"
elif test "x$FP_ISOSX" != x ; then
FP_PLUGIN_LIB="lib${FP_NAME}.so" # Should this include the version number in the name?
else # Presumably some form on *nix"
FP_PLUGIN_LIB="lib${FP_NAME}.so"
fi
# Figure out the path to where the lib is stored
# This can probably be simplified
# Case 1: Cmake with Visual Studio
# Do not know where to look for a dylib
# Case 1: Cmake with Visual Studio
if test "x$FP_ISCMAKE" != x -a "x${FP_ISMSVC}" != x ; then
# Case 1a: ignore the build type directory
if test -f "${FP_PLUGINS}/${FP_PLUGIN_LIB}" ; then
FP_PLUGIN_PATH="${FP_PLUGINS}"
fi
else # Case 2: automake
# Case 2a: look in .libs
if test -f "${FP_PLUGINS}/.libs/${FP_PLUGIN_LIB}" ; then
FP_PLUGIN_PATH="${FP_PLUGINS}/.libs"
else # Case 2: look in FP_PLUGINS directly
if test -f "${FP_PLUGINS}/${FP_PLUGIN_LIB}" ; then
FP_PLUGIN_PATH="${FP_PLUGINS}"
fi
fi
fi
# Verify
if test "x$FP_PLUGIN_PATH" = x ; then
echo "***Fail: Could not locate a usable HDF5_PLUGIN_PATH"
return 1
fi
if ! test -f "$FP_PLUGIN_PATH/$FP_PLUGIN_LIB" ; then
echo "***Fail: Could not locate a usable HDF5_PLUGIN_LIB"
return 1
fi
# If we are operating using both Visual Studio and Cygwin,
# then we need to convert the FP_PLUGIN_PATH to windows format
if test "x$FP_ISMSVC" != x -a "x$FP_ISCYGWIN" != x ; then
FP_PLUGIN_PATH=`cygpath -wl $FP_PLUGIN_PATH`
fi
# Set the final output variables
HDF5_PLUGIN_LIB="$FP_PLUGIN_LIB"
HDF5_PLUGIN_PATH="$FP_PLUGIN_PATH"
return 0
}
# debug
if test "x$1" != x ; then
findplugin
echo "HDF5_PLUGIN_PATH=|$FP_PLUGIN_PATH|"
fi
......@@ -31,6 +31,6 @@ namespace netCDF
*/
void ncCheckDataMode(int ncid);
};
}
#endif
#include "ncDim.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <algorithm>
using namespace std;
namespace netCDF {
// Global comparator operator ==============
// comparator operator
bool operator<(const NcDim& lhs,const NcDim& rhs)
{
return false;
}
// comparator operator
bool operator>(const NcDim& lhs,const NcDim& rhs)
{
return true;
}
}
using namespace netCDF;
// assignment operator
NcDim& NcDim::operator=(const NcDim & rhs)
{
nullObject = rhs.nullObject;
myId = rhs.myId;
groupId = rhs.groupId;
return *this;
}
// The copy constructor.
NcDim::NcDim(const NcDim& rhs):
nullObject(rhs.nullObject),
myId(rhs.myId),
groupId(rhs.groupId)
{}
// equivalence operator
bool NcDim::operator==(const NcDim& rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myId == rhs.myId && groupId == rhs.groupId;
}
// != operator
bool NcDim::operator!=(const NcDim & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
NcGroup NcDim::getParentGroup() const {
return NcGroup(groupId);
}
// Constructor generates a null object.
NcDim::NcDim() :
nullObject(true)
{}
// Constructor for a dimension (must already exist in the netCDF file.)
NcDim::NcDim(const NcGroup& grp, int dimId) :
nullObject(false)
{
groupId = grp.getId();
myId = dimId;
}
// gets the size of the dimension, for unlimited, this is the current number of records.
size_t NcDim::getSize() const
{
size_t dimSize;
ncCheck(nc_inq_dimlen(groupId, myId, &dimSize),__FILE__,__LINE__);
return dimSize;
}
// returns true if this dimension is unlimited.
bool NcDim::isUnlimited() const
{
int numlimdims;
int* unlimdimidsp=NULL;
// get the number of unlimited dimensions
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,unlimdimidsp),__FILE__,__LINE__);
if (numlimdims){
// get all the unlimited dimension ids in this group
vector<int> unlimdimid(numlimdims);
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,&unlimdimid[0]),__FILE__,__LINE__);
vector<int>::iterator it;
// now look to see if this dimension is unlimited
it = find(unlimdimid.begin(),unlimdimid.end(),myId);
return it != unlimdimid.end();
}
return false;
}
// gets the name of the dimension.
const string NcDim::getName() const
{
char dimName[NC_MAX_NAME+1];
ncCheck(nc_inq_dimname(groupId, myId, dimName),__FILE__,__LINE__);
return string(dimName);
}
// renames this dimension.
void NcDim::rename(const string& name)
{
ncCheck(nc_rename_dim(groupId, myId, name.c_str()),__FILE__,__LINE__);
}
#include "ncDim.h"
#include "ncGroup.h"
#include "ncCheck.h"
#include <algorithm>
using namespace std;
namespace netCDF {
// Global comparator operator ==============
// comparator operator
bool operator<(const NcDim& lhs,const NcDim& rhs)
{
return false;
}
// comparator operator
bool operator>(const NcDim& lhs,const NcDim& rhs)
{
return true;
}
}
using namespace netCDF;
// assignment operator
NcDim& NcDim::operator=(const NcDim & rhs)
{
nullObject = rhs.nullObject;
myId = rhs.myId;
groupId = rhs.groupId;
return *this;
}
// The copy constructor.
NcDim::NcDim(const NcDim& rhs):
nullObject(rhs.nullObject),
myId(rhs.myId),
groupId(rhs.groupId)
{}
// equivalence operator
bool NcDim::operator==(const NcDim& rhs) const
{
if(nullObject)
return nullObject == rhs.nullObject;
else
return myId == rhs.myId && groupId == rhs.groupId;
}
// != operator
bool NcDim::operator!=(const NcDim & rhs) const
{
return !(*this == rhs);
}
// Gets parent group.
NcGroup NcDim::getParentGroup() const {
return NcGroup(groupId);
}
// Constructor generates a null object.
NcDim::NcDim() :
nullObject(true)
{}
// Constructor for a dimension (must already exist in the netCDF file.)
NcDim::NcDim(const NcGroup& grp, int dimId) :
nullObject(false)
{
groupId = grp.getId();
myId = dimId;
}
// gets the size of the dimension, for unlimited, this is the current number of records.
size_t NcDim::getSize() const
{
size_t dimSize;
ncCheck(nc_inq_dimlen(groupId, myId, &dimSize),__FILE__,__LINE__);
return dimSize;
}
// returns true if this dimension is unlimited.
bool NcDim::isUnlimited() const
{
int numlimdims;
int* unlimdimidsp=NULL;
// get the number of unlimited dimensions
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,unlimdimidsp),__FILE__,__LINE__);
if (numlimdims){
// get all the unlimited dimension ids in this group
vector<int> unlimdimid(numlimdims);
ncCheck(nc_inq_unlimdims(groupId,&numlimdims,&unlimdimid[0]),__FILE__,__LINE__);
vector<int>::iterator it;
// now look to see if this dimension is unlimited
it = find(unlimdimid.begin(),unlimdimid.end(),myId);
return it != unlimdimid.end();
}
return false;
}
// gets the name of the dimension.
string NcDim::getName() const
{
char dimName[NC_MAX_NAME+1];
ncCheck(nc_inq_dimname(groupId, myId, dimName),__FILE__,__LINE__);
return string(dimName);
}
// renames this dimension.
void NcDim::rename(const string& name)
{
ncCheck(nc_rename_dim(groupId, myId, name.c_str()),__FILE__,__LINE__);
}