Commit 2592240b authored by Jan Kotanski's avatar Jan Kotanski
Browse files

New upstream version 0.0.8

parent 495dd51d
......@@ -2,6 +2,7 @@
/cmake-build-*/
*.user
.idea/workspace.xml
.idea/usage.statistics.xml
*.swp
/file_open.h5
......
......@@ -4,6 +4,7 @@
<component name="CidrRootsConfiguration">
<excludeRoots>
<file path="$PROJECT_DIR$/build" />
<file path="$PROJECT_DIR$/cmake-build-debug" />
</excludeRoots>
</component>
<component name="JavaScriptSettings">
......
cmake_minimum_required(VERSION 3.0.0)
project(h5cpp
LANGUAGES CXX C
VERSION 0.0.7
VERSION 0.0.8
)
#=============================================================================
......
......@@ -3,74 +3,38 @@ coverage_os = "centos7-release"
images = [
'centos7-release': [
'name': 'essdmscdm/centos7-build-node:1.1.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': 'sh',
'cmake_flags': '-DCOV=ON -DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Release'
],
'centos7-gcc6-release': [
'name': 'essdmscdm/centos7-gcc6-build-node:2.2.0',
'name': 'essdmscdm/centos7-build-node:3.0.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': '/usr/bin/scl enable rh-python35 devtoolset-6 -- /bin/bash',
'cmake_flags': '-DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Release'
],
'fedora25-release': [
'name': 'essdmscdm/fedora25-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
'cmake_flags': '-DCOV=1 -DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Release'
],
'debian9-release': [
'name': 'essdmscdm/debian9-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
],
'ubuntu1604-release': [
'name': 'essdmscdm/ubuntu16.04-build-node:2.4.0',
'name': 'essdmscdm/debian9-build-node:2.0.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
],
'ubuntu1710-release': [
'name': 'essdmscdm/ubuntu17.10-build-node:2.1.1',
'ubuntu1804-release': [
'name': 'essdmscdm/ubuntu18.04-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
],
'centos7-debug': [
'name': 'essdmscdm/centos7-build-node:1.1.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': 'sh',
'cmake_flags': '-DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Debug'
],
'centos7-gcc6-debug': [
'name': 'essdmscdm/centos7-gcc6-build-node:2.2.0',
'name': 'essdmscdm/centos7-build-node:3.0.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': '/usr/bin/scl enable rh-python35 devtoolset-6 -- /bin/bash',
'cmake_flags': '-DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Debug'
],
'fedora25-debug': [
'name': 'essdmscdm/fedora25-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
],
'debian9-debug': [
'name': 'essdmscdm/debian9-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
],
'ubuntu1604-debug': [
'name': 'essdmscdm/ubuntu16.04-build-node:2.4.0',
'name': 'essdmscdm/debian9-build-node:2.0.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
],
'ubuntu1710-debug': [
'name': 'essdmscdm/ubuntu17.10-build-node:2.1.1',
'ubuntu1804-debug': [
'name': 'essdmscdm/ubuntu18.04-build-node:1.1.0',
'cmake': 'cmake',
'sh': 'sh',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
......
......@@ -125,7 +125,7 @@ cmake -DCMAKE_INSTALL_PREFIX=/home/user1/some/path ..
```
and accordingly, when building the client program:
```bash
cmake -Dh5cpp_DIR=/home/user1/some/path/lib/cmake/h5cpp-0.0.6 path/to/your/source
cmake -Dh5cpp_DIR=/home/user1/some/path/lib/cmake/h5cpp-0.0.8 path/to/your/source
```
where version number may vary.
......
......@@ -3,7 +3,7 @@ set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.41 COMPONENTS filesystem REQUIRED)
find_package(Boost 1.41 COMPONENTS filesystem system REQUIRED)
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
add_definitions(-DBOOST_ALL_DYN_LINK)
......
......@@ -20,7 +20,7 @@ if(NOT GTest_FOUND)
if(LSB_CODENAME MATCHES stretch)
set(GTEST_SOURCE_DIR /usr/src/googletest/googletest)
elseif(LSB_CODENAME MATCHES jessie OR LSB_CODENAME MATCHES xenial)
elseif(LSB_CODENAME MATCHES jessie OR LSB_CODENAME MATCHES xenial OR LSB_CODENAME MATCHES bionic)
set(GTEST_SOURCE_DIR /usr/src/gtest)
endif()
......
[requires]
Boost/1.62.0@lasote/stable
cmake_findboost_modular/1.66.0@bincrafters/stable
boost_filesystem/1.66.0@bincrafters/stable
hdf5/1.10.1@eugenwintersberger/testing
gtest/1.8.0@conan/stable
zlib/1.2.8@conan/stable
......@@ -9,10 +10,9 @@ bzip2/1.0.6@conan/stable
cmake
[options]
Boost:shared=True
boost_filesystem:shared=True
hdf5:shared=True
gtest:shared=True
Boost:python=False
zlib:shared=True
[imports]
......
[requires]
Boost/1.62.0@ess-dmsc/stable
cmake_findboost_modular/1.66.0@bincrafters/stable
boost_filesystem/1.66.0@bincrafters/stable
boost_system/1.66.0@bincrafters/stable
hdf5/1.10.2-dm2@ess-dmsc/stable
gtest/3121b20-dm3@ess-dmsc/stable
......@@ -8,7 +10,8 @@ cmake
virtualbuildenv
[options]
Boost:shared=True
boost_filesystem:shared=True
boost_system:shared=True
hdf5:shared=True
hdf5:cxx=False
gtest:shared=True
......
[requires]
Boost/1.62.0@ess-dmsc/stable
cmake_findboost_modular/1.66.0@bincrafters/stable
boost_filesystem/1.66.0@bincrafters/stable
hdf5/1.10.2-dm2@ess-dmsc/stable
gtest/3121b20-dm3@ess-dmsc/stable
......@@ -8,7 +9,7 @@ cmake
virtualbuildenv
[options]
Boost:shared=True
boost_filesystem:shared=True
hdf5:shared=True
hdf5:cxx=False
hdf5:parallel=True
......
......@@ -61,9 +61,9 @@ author = u'Eugen Wintersberger'
# built documents.
#
# The short X.Y version.
version = u'0.0.6'
version = u'0.0.8'
# The full version, including alpha/beta/rc tags.
release = u'0.0.6'
release = u'0.0.8'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......@@ -137,7 +137,7 @@ html_theme = 'bizstyle'
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'h5++ library design v0.0.6'
# html_title = u'h5++ library design v0.0.8'
# A shorter title for the navigation bar. Default is the same as html_title.
#
......
......@@ -141,7 +141,7 @@ html_theme = 'bizstyle'
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'h5++ v0.0.6'
# html_title = u'h5++ v0.0.8'
# A shorter title for the navigation bar. Default is the same as html_title.
#
......
......@@ -7,7 +7,7 @@ Using *h5cpp* with :program:`cmake`
*h5cpp* not only uses *CMake* as a build system but also provides
a *CMake* package which makes using the library with *CMake* quite simple.
The *CMake* package is installed below :file:`PREFIX/lib/cmake/h5cpp-0.0.6`
The *CMake* package is installed below :file:`PREFIX/lib/cmake/h5cpp-0.0.8`
where :envvar:`PREFIX` expands to the installation prefix used in the
inital cmake call of the installation procedure.
......@@ -41,7 +41,7 @@ the following :file:`CMakeLists.txt` fiel is sufficient
cmake_minimum_required(VERSION 3.5.0)
project(h5cpp_test
LANGUAGES C CXX
VERSION 0.0.6)
VERSION 0.0.8)
set(CMAKE_CXX_STANDARD 11)
find_package(h5cpp REQUIRED)
......@@ -56,7 +56,7 @@ You can build the code with
h5cpp_test:$ mkdir build
h5cpp_test:$ cd build
h5cpp_test:$ cmake -Dh5cpp_DIR=<INSTALLPREFIX>/lib/cmake/h5cpp-0.0.6 ../
h5cpp_test:$ cmake -Dh5cpp_DIR=<INSTALLPREFIX>/lib/cmake/h5cpp-0.0.8 ../
h5cpp_test:$ make
The cmake variable :envvar:`h5cpp_DIR` tells :program:`cmake` where to look
......
......@@ -26,7 +26,7 @@ add_library(h5cpp SHARED
add_doxygen_source_deps(${h5cpp_headers})
target_compile_definitions(h5cpp PRIVATE DLL_BUILD)
set(H5CPP_LINKS Boost::filesystem ${MPI_CXX_LIBRARIES})
set(H5CPP_LINKS Boost::filesystem Boost::system ${MPI_CXX_LIBRARIES})
#
# remove the absolute path from the library name
......
......@@ -26,7 +26,7 @@
//
#include <h5cpp/core/path.hpp>
#include <boost/algorithm/string.hpp>
#include <sstream>
namespace hdf5 {
......@@ -50,6 +50,34 @@ bool absolute_path_string(const std::string &str)
return false;
}
std::string join_string(const std::list<std::string> &to_join,
const std::string &separator)
{
std::ostringstream ss;
for (const auto &string_item : to_join)
{
ss << string_item << separator;
}
std::string result = ss.str();
if (!result.empty())
result.pop_back(); // remove trailing separator
return result;
}
std::list<std::string> split_string(const std::string &to_split,
char delim)
{
std::stringstream ss(to_split);
std::string item;
std::list<std::string> elems;
while (std::getline(ss, item, delim)) {
// Don't create empty elements when the delimiter is repeated
if (!item.empty())
elems.push_back(std::move(item));
}
return elems;
}
std::list<std::string> str_to_list(const std::string &str)
{
std::list<std::string> result;
......@@ -66,8 +94,7 @@ std::list<std::string> str_to_list(const std::string &str)
if(str.back()=='/') string_end--;
std::string buffer(string_start,string_end);
boost::split(result,buffer,
boost::is_any_of("/"),boost::token_compress_on);
result = split_string(buffer, '/');
return result;
}
......@@ -86,7 +113,7 @@ std::string Path::to_string() const
if (!absolute() && link_names_.empty())
return ".";
return (absolute() ? "/" : "")
+ boost::algorithm::join(link_names_, "/");
+ join_string(link_names_, "/");
}
Path::Path():
......
......@@ -22,6 +22,7 @@
// Authors:
// Eugen Wintersberger <eugen.wintersberger@desy.de>
// Martin Shetty <martin.shetty@esss.se>
// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Aug 23, 2017
//
......@@ -44,5 +45,22 @@ Integer::Integer(const Datatype &datatype) :
}
}
bool Integer::is_signed() const {
auto s = H5Tget_sign(static_cast<hid_t>(*this));
if (s < 0) {
error::Singleton::instance().throw_with_stack("Could not retrieve datatype sign");
return false;
}
return bool(s);
}
void Integer::make_signed(bool sign) const {
if (H5Tset_sign(static_cast<hid_t>(*this), (sign ? H5T_SGN_2 : H5T_SGN_NONE)) < 0) {
std::stringstream ss;
ss << "Could not set datatype sign to " << sign;
error::Singleton::instance().throw_with_stack(ss.str());
}
}
} // namespace datatype
} // namespace hdf5
......@@ -22,6 +22,7 @@
// Authors:
// Eugen Wintersberger <eugen.wintersberger@desy.de>
// Martin Shetty <martin.shetty@esss.se>
// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Aug 23, 2017
//
#pragma once
......@@ -75,6 +76,21 @@ class DLL_EXPORT Integer : public Datatype {
//!
Integer(const Datatype &datatype);
//!
//! @brief Retrieves the sign type for an integer type.
//!
//! @throws std::runtime_error in case of a failure
//!
virtual bool is_signed() const;
//!
//! @brief Sets the sign property for an integer type.
//!
//! @throws std::runtime_error in case of a failure
//!
virtual void make_signed(bool sign) const;
};
} // namespace datatype
......
......@@ -231,12 +231,12 @@ bool Group::has_dataset(const Path &path, const property::LinkAccessList &lapl)
return ret;
}
Group Group::get_group(const Path &path, const property::LinkAccessList &lapl)
Group Group::get_group(const Path &path, const property::LinkAccessList &lapl) const
{
return hdf5::node::get_group(*this, path, lapl);
}
Dataset Group::get_dataset(const Path &path, const property::LinkAccessList &lapl)
Dataset Group::get_dataset(const Path &path, const property::LinkAccessList &lapl) const
{
return hdf5::node::get_dataset(*this, path, lapl);
}
......
......@@ -362,7 +362,7 @@ class DLL_EXPORT Group : public Node
//! \sa get_dataset
//!
Group get_group(const Path &path,
const property::LinkAccessList &lapl = property::LinkAccessList());
const property::LinkAccessList &lapl = property::LinkAccessList()) const;
//!
//! \brief get dataset
......@@ -385,7 +385,7 @@ class DLL_EXPORT Group : public Node
//! \sa get_dataset
//!
Dataset get_dataset(const Path &path,
const property::LinkAccessList &lapl = property::LinkAccessList());
const property::LinkAccessList &lapl = property::LinkAccessList()) const;
private:
......
......@@ -39,6 +39,12 @@ class Integer : public testing::Test {
T value_;
};
template <class T>
class SignedInteger : public Integer<T> { };
template <class T>
class UnsignedInteger : public Integer<T> { };
using testing::Types;
// The list of types we want to test.
......@@ -51,7 +57,24 @@ Types<
long long, unsigned long long>
test_types;
// The list of unsigned types we want to test.
typedef
Types<
unsigned char,
unsigned short,
unsigned int,
unsigned long,
unsigned long long>
test_unsigned_types;
// The list of signed types we want to test.
typedef
Types<char, signed char, short, int, long, long long>
test_signed_types;
TYPED_TEST_CASE(Integer, test_types);
TYPED_TEST_CASE(SignedInteger, test_signed_types);
TYPED_TEST_CASE(UnsignedInteger, test_unsigned_types);
TYPED_TEST(Integer, Exceptions) {
datatype::Datatype dtype;
......@@ -76,3 +99,23 @@ TYPED_TEST(Integer, General) {
EXPECT_THROW((datatype::Integer(default_constructed)), std::runtime_error);
}
TYPED_TEST(SignedInteger, Signed) {
auto t = datatype::create<decltype(this->value_)>();
ASSERT_EQ(t.is_signed(), true);
t.make_signed(true);
ASSERT_EQ(t.is_signed(), true);
t.make_signed(false);
ASSERT_EQ(t.is_signed(), false);
}
TYPED_TEST(UnsignedInteger, Signed) {
auto t = datatype::create<decltype(this->value_)>();
ASSERT_EQ(t.is_signed(), false);
t.make_signed(true);
ASSERT_EQ(t.is_signed(), true);
t.make_signed(false);
ASSERT_EQ(t.is_signed(), false);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment