add cmake files for hdf5 part + fix compile errors

This commit is contained in:
Christian Zimmermann 2023-01-13 12:26:23 +01:00
parent caed6b4469
commit 5dd114f03f
9 changed files with 53 additions and 21 deletions

View file

@ -3,8 +3,8 @@ include_directories(${CMAKE_SOURCE_DIR}/src/include)
add_subdirectory(tests)
add_subdirectory(lib)
#if(ENABLE_hdf5)
# add_subdirectory(opt/hdf5)
#endif()
if(ENABLE_hdf5)
add_subdirectory(opt/hdf5)
endif()
install(DIRECTORY include/ DESTINATION ${INSTALL_PATH}/include)

View file

@ -0,0 +1,8 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_subdirectory(lib)
#add_subdirectory(tests)
set(HDF5_INSTALL_PATH ${INSTALL_PATH}/hdf5)
install(DIRECTORY include/ DESTINATION ${HDF5_INSTALL_PATH}/include)

View file

@ -30,10 +30,10 @@ namespace CNORXZ
virtual ContentBase& load() = 0;
virtual ContentBase& write() = 0;
virtual ContentBase& close() = 0;
virtual MArray<ContentBase>* get() = 0;
virtual const MArray<ContentBase>* get() const = 0;
virtual MArray<Sptr<ContentBase>>* get() = 0;
virtual const MArray<Sptr<ContentBase>>* get() const = 0;
virtual String path() const = 0;
virtual String file() const = 0;
virtual String filename() const = 0;
const String& name() const;
const ContentBase* parent() const;
@ -46,9 +46,10 @@ namespace CNORXZ
RangePtr mRange;
hid_t mId = 0;
};
}
typedef Sptr<ContentType> ContentPtr;
typedef Sptr<ContentBase> ContentPtr;
}
}
#endif

View file

@ -22,8 +22,8 @@ namespace CNORXZ
virtual File& load() override final;
virtual File& write() override final;
virtual File& close() override final;
virtual MArray<ContentBase>* get() override final;
virtual const MArray<ContentBase>* get() const override final;
virtual MArray<Sptr<ContentBase>>* get() override final;
virtual const MArray<Sptr<ContentBase>>* get() const override final;
virtual String path() const override final;
virtual String filename() const override final;

View file

@ -19,8 +19,8 @@ namespace CNORXZ
virtual bool ro() const override final;
virtual Group& load() override final;
virtual Group& close() override final;
virtual MArray<ContentBase>* get() override final;
virtual const MArray<ContentBase>* get() const override final;
virtual MArray<Sptr<ContentBase>>* get() override final;
virtual const MArray<Sptr<ContentBase>>* get() const override final;
virtual String path() const override final;
virtual String filename() const override final;

View file

@ -0,0 +1,22 @@
set(libcnorxzhdf5_a_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/h5_content_base.cc
${CMAKE_CURRENT_SOURCE_DIR}/h5_file.cc
${CMAKE_CURRENT_SOURCE_DIR}/h5_group.cc
)
add_library(cnorxzhdf5_obj OBJECT
${libcnorxzhdf5_a_SOURCES}
)
set_target_properties(cnorxzhdf5_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_library(cnorxzhdf5 SHARED
$<TARGET_OBJECTS:cnorxzhdf5_obj>
)
set_target_properties(cnorxzhdf5 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
install(TARGETS cnorxz
ARCHIVE DESTINATION ${HDF5_INSTALL_PATH}/lib
LIBRARY DESTINATION ${HDF5_INSTALL_PATH}/lib
)

View file

@ -6,7 +6,7 @@ namespace CNORXZ
namespace hdf5
{
ContentBase::ContentBase(const String& _name, const ContentBase* _parent) :
mName(_name), mParent(parent)
mName(_name), mParent(_parent)
{}
const String& ContentBase::name() const

View file

@ -1,5 +1,6 @@
#include "h5_file.h"
#include <fstream>
namespace CNORXZ
{
@ -54,7 +55,7 @@ namespace CNORXZ
{
CXZ_ASSERT( not mRo, "could not write to file: opened as read-only" );
for(auto& x: mCont){
x.write();
x->write();
}
return *this;
}
@ -62,7 +63,7 @@ namespace CNORXZ
File& File::close()
{
for(auto& x: mCont){
x.close();
x->close();
}
if(mId != 0){
H5Fclose(mId);
@ -70,12 +71,12 @@ namespace CNORXZ
return *this;
}
MArray<ContentBase>* File::get()
MArray<Sptr<ContentBase>>* File::get()
{
return &mCont;
}
const MArray<ContentBase>* File::get() const
const MArray<Sptr<ContentBase>>* File::get() const
{
return &mCont;
}

View file

@ -48,14 +48,14 @@ namespace CNORXZ
return *this;
}
MArray<ContentBase>* Group::get()
MArray<Sptr<ContentBase>>* Group::get()
{
return mCont;
return &mCont;
}
const MArray<ContentBase>* Group::get() const
const MArray<Sptr<ContentBase>>* Group::get() const
{
return mCont;
return &mCont;
}
String Group::path() const