diff --git a/src/dataspace/selection.cpp b/src/dataspace/selection.cpp index cc494ff940..31de045b53 100644 --- a/src/dataspace/selection.cpp +++ b/src/dataspace/selection.cpp @@ -235,6 +235,20 @@ void Hyperslab::apply(const Dataspace &space,SelectionOperation ops) const } } +SelectionList operator|(const Hyperslab &a,const Hyperslab &b) +{ + return {{SelectionOperation::SET,Selection::SharedPointer(new Hyperslab(a))}, + {SelectionOperation::OR,Selection::SharedPointer(new Hyperslab(b))} + }; +} + +SelectionList &operator|(SelectionList &selections,const Hyperslab &b) +{ + selections.push_back({SelectionOperation::SET, + Selection::SharedPointer(new Hyperslab(b))}); + return selections; +} + Points::Points(): Selection() diff --git a/src/include/h5cpp/dataspace/selection.hpp b/src/include/h5cpp/dataspace/selection.hpp index 08206d43ed..0d747215b5 100644 --- a/src/include/h5cpp/dataspace/selection.hpp +++ b/src/include/h5cpp/dataspace/selection.hpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include namespace hdf5 { namespace dataspace { @@ -38,6 +40,13 @@ namespace dataspace { class DLL_EXPORT Selection { public: + //! + //! \brief pointer for selection stacks + //! + //! As selections use virtual functions for being applied we have to + using UniquePointer = std::unique_ptr; + using SharedPointer = std::shared_ptr; + //! //! \brief default constructor //! @@ -73,6 +82,9 @@ class DLL_EXPORT Selection SelectionOperation ops) const = 0; }; +using SelectionPair = std::pair; +using SelectionList = std::list; + //! //! \brief hyperslab selection class //! @@ -308,6 +320,9 @@ class DLL_EXPORT Hyperslab : public Selection }; +SelectionList operator|(const Hyperslab &a,const Hyperslab &b); +SelectionList& operator|(SelectionList &selections,const Hyperslab &b); + class DLL_EXPORT Points : public Selection {