Skip to content

Commit

Permalink
fixed many warnings, some formatting fixed, enum style fix for filter
Browse files Browse the repository at this point in the history
  • Loading branch information
martukas committed Mar 23, 2019
1 parent e121292 commit f3e8316
Show file tree
Hide file tree
Showing 27 changed files with 301 additions and 296 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/build*/
/cmake-build-*/
*.user
.idea
.idea/

*.swp
Expand Down
1 change: 1 addition & 0 deletions src/h5cpp/datatype/enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class DLL_EXPORT Enum : public Datatype
template<typename T>
void Enum::check_type(const T& data) const
{
(void) data; // < var unused, only for type inference
auto mem_type = datatype::create<T>();
if (mem_type != super())
{
Expand Down
2 changes: 1 addition & 1 deletion src/h5cpp/file/direct_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void DirectDriver::operator()(const property::FileAccessList &fapl) const

DriverID DirectDriver::id() const noexcept
{
return DriverID::eDIRECT;
return DriverID::eDirect;
}

} // namespace file
Expand Down
66 changes: 35 additions & 31 deletions src/h5cpp/file/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,28 @@
//
// Forward declaration of property lists
//
namespace hdf5 {
namespace property {
namespace hdf5
{
namespace property
{
class FileAccessList;
}
}

} // namespace property
} // namespace hdf5

namespace hdf5 {
namespace file {
namespace hdf5
{
namespace file
{

//!
//! \brief enumeration to determine the file driver
//!
enum class DriverID : unsigned {

ePOSIX = 1,
eDIRECT = 2,
eMEMORY = 3,
eMPI = 4
enum class DriverID : unsigned
{
ePosix = 1,
eDirect = 2,
eMemory = 3,
eMPI = 4
};

//!
Expand All @@ -61,27 +64,28 @@ enum class DriverID : unsigned {
//!
class DLL_EXPORT Driver
{
public:
//!
//! \brief unique pointer type
//!
using UniquePointer = std::unique_ptr<Driver>;
public:
//!
//! \brief unique pointer type
//!
using UniquePointer = std::unique_ptr<Driver>;

virtual ~Driver(){}
virtual ~Driver()
{}

//!
//! \brief set a driver
//!
//! Sets a driver to a particular file access property list.
//!
virtual void operator()(const hdf5::property::FileAccessList &fapl) const = 0;
//!
//! \brief set a driver
//!
//! Sets a driver to a particular file access property list.
//!
virtual void operator()(const hdf5::property::FileAccessList& fapl) const = 0;

//!
//! \brief get driver ID
//!
//! Return the ID of a particular driver.
//1
virtual DriverID id() const noexcept = 0;
//!
//! \brief get driver ID
//!
//! Return the ID of a particular driver.
//1
virtual DriverID id() const noexcept = 0;
};

} // namespace file
Expand Down
2 changes: 1 addition & 1 deletion src/h5cpp/file/memory_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void MemoryDriver::operator()(const property::FileAccessList &fapl) const

DriverID MemoryDriver::id() const noexcept
{
return DriverID::eMEMORY;
return DriverID::eMemory;
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/h5cpp/file/posix_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void PosixDriver::operator()(const property::FileAccessList &fapl) const

DriverID PosixDriver::id() const noexcept
{
return DriverID::ePOSIX;
return DriverID::ePosix;
}

} // namespace file
Expand Down
4 changes: 2 additions & 2 deletions test/attribute/attribute_h5py_bool_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_F(H5pyBoolTest, test_read_vector_bool)
std::vector<unsigned char> buffer2(4);
std::vector<unsigned char> ref2 = {0, 1, 1, 0};
EXPECT_EQ(a.datatype().get_class(), datatype::Class::ENUM);
EXPECT_EQ(a.datatype().size(), 1);
EXPECT_EQ(a.datatype().size(), 1ul);
a.read(buffer2);
EXPECT_EQ(buffer2, ref2);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ TEST_F(H5pyBoolTest, test_read_vector_ebool)
datatype::EBool::TRUE,
datatype::EBool::TRUE,
datatype::EBool::FALSE};
EXPECT_EQ(a.datatype().size(), 1);
EXPECT_EQ(a.datatype().size(), 1ul);
a.read(buffer);
EXPECT_EQ(buffer, eref);
}
Expand Down
2 changes: 0 additions & 2 deletions test/attribute/attribute_name_access_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ TEST_F(AttributeName, test_iterator_random_access)
root_.attributes.iterator_config().order(IterationOrder::DECREASING);

std::vector<std::string> ref_names{"index","elasticity","counter"};
auto ref_iter = ref_names.begin();


auto iter = root_.attributes.begin();
auto iter_end = root_.attributes.end();
Expand Down
45 changes: 23 additions & 22 deletions test/attribute/attribute_pniio_bool_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,50 +31,51 @@ using namespace hdf5;

class PNIIOBoolTest : public testing::Test
{
protected:
file::File pniio_file;
node::Group root_group;
protected:
file::File pniio_file;
node::Group root_group;

virtual void SetUp()
{
pniio_file = file::open("./pniio_test_boolattr.h5",file::AccessFlags::READONLY);
root_group = pniio_file.root();
}
virtual void SetUp()
{
pniio_file = file::open("./pniio_test_boolattr.h5", file::AccessFlags::READONLY);
root_group = pniio_file.root();
}

};

#ifndef _MSC_VER

TEST_F(PNIIOBoolTest, test_read_simple_bool)
{
auto attrue = root_group.attributes["bool_true"];
auto attrue = root_group.attributes["bool_true"];
bool buffer;
attrue.read(buffer);
EXPECT_EQ(buffer, true);
bool buffer2;
auto atfalse = root_group.attributes["bool_false"];
auto atfalse = root_group.attributes["bool_false"];
atfalse.read(buffer2);
EXPECT_EQ(buffer2, false);
}

TEST_F(PNIIOBoolTest, test_read_vector_bool)
{
auto a = root_group.attributes["bool_array"];
auto a = root_group.attributes["bool_array"];
// missing iterator which points to separate bits
// std::vector<bool> buffer(4);
// std::vector<bool> ref = {false, true, true, false};
// a.read(buffer);
// EXPECT_EQ(buffer, ref);
std::vector<unsigned char> buffer2(4);
std::vector<unsigned char> ref2 = {0, 1, 1, 0};
std::vector<unsigned char> ref2 = {0, 1, 1, 0};
EXPECT_EQ(a.datatype().get_class(), datatype::Class::INTEGER);
EXPECT_EQ(a.datatype().size(), 1);
EXPECT_EQ(a.datatype().size(), 1ul);
a.read(buffer2);
EXPECT_EQ(buffer2, ref2);
}

TEST_F(PNIIOBoolTest, test_read_scalar_ebool)
{
auto attrue = root_group.attributes["bool_true"];
auto attrue = root_group.attributes["bool_true"];
datatype::EBool buffer;
// does not work because of #309, #347
// attrue.read(buffer);
Expand All @@ -83,7 +84,7 @@ TEST_F(PNIIOBoolTest, test_read_scalar_ebool)
EXPECT_EQ(buffer, 1);
EXPECT_EQ(buffer, datatype::EBool::TRUE);
datatype::EBool buffer2;
auto atfalse = root_group.attributes["bool_false"];
auto atfalse = root_group.attributes["bool_false"];
// does not work because of #309, #347
// atfalse.read(buffer2);
atfalse.read(buffer2, atfalse.datatype());
Expand All @@ -92,20 +93,20 @@ TEST_F(PNIIOBoolTest, test_read_scalar_ebool)
EXPECT_EQ(buffer2, datatype::EBool::FALSE);
}


TEST_F(PNIIOBoolTest, test_read_vector_ebool)
{
auto a = root_group.attributes["bool_array"];
auto a = root_group.attributes["bool_array"];
std::vector<datatype::EBool> buffer(4);
std::vector<datatype::EBool> eref = {datatype::EBool::FALSE,
datatype::EBool::TRUE,
datatype::EBool::TRUE,
datatype::EBool::FALSE};
std::vector<datatype::EBool> eref = {datatype::EBool::FALSE,
datatype::EBool::TRUE,
datatype::EBool::TRUE,
datatype::EBool::FALSE};
EXPECT_EQ(a.datatype().get_class(), datatype::Class::INTEGER);
EXPECT_EQ(a.datatype().size(), 1);
EXPECT_EQ(a.datatype().size(), 1ul);
// does not work because of #309, #347
// a.read(buffer);
a.read(buffer, a.datatype());
EXPECT_EQ(buffer, eref);
}

#endif
4 changes: 2 additions & 2 deletions test/attribute/attribute_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ TEST_F(Attribute, test_multidim_simple_construction)
EXPECT_EQ(a.name(),"test");
EXPECT_EQ(a.dataspace().type(),dataspace::Type::SIMPLE);
dataspace::Simple space(a.dataspace());
EXPECT_EQ(space.rank(),1);
EXPECT_EQ(space.rank(),1u);
EXPECT_EQ(space.current_dimensions()[0],1ul);

EXPECT_NO_THROW(a = root_.attributes.create<int>("matrix",{3,4}));
EXPECT_EQ(a.name(),"matrix");
space = dataspace::Simple(a.dataspace());
EXPECT_EQ(space.rank(),2);
EXPECT_EQ(space.rank(),2u);
EXPECT_EQ(space.current_dimensions()[0],3ul);
EXPECT_EQ(space.current_dimensions()[1],4ul);

Expand Down
2 changes: 1 addition & 1 deletion test/dataspace/hyperslab_simple_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ TEST(HyperslabSimple, ConvenienceConsructors) {

TEST(HyperslabSimple, test_case_1) {
dataspace::Simple space({10, 20});
EXPECT_EQ(space.rank(), 2);
EXPECT_EQ(space.rank(), 2ul);
EXPECT_EQ(space.size(), 200);
dataspace::Hyperslab slab({1, 1}, {5, 5}, {1, 1}, {1, 1});
space.selection(dataspace::SelectionOperation::SET, slab);
Expand Down
Loading

0 comments on commit f3e8316

Please sign in to comment.