diff --git a/doc/doxy/Doxyfile b/doc/doxy/Doxyfile index 22ad033..d642b5f 100644 --- a/doc/doxy/Doxyfile +++ b/doc/doxy/Doxyfile @@ -1132,7 +1132,7 @@ FORTRAN_COMMENT_AFTER = 72 # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = NO +SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. diff --git a/src/include/base/assert.h b/src/include/base/assert.h index a7d7d7c..0580bfe 100644 --- a/src/include/base/assert.h +++ b/src/include/base/assert.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/assert.h @@ -13,13 +14,27 @@ #include #include +/** library error tag */ #define CXZ_ERRTAG __FILE__ << '@' << __LINE__ << '(' << __func__ << "): error" + +/** library warning tag */ #define CXZ_WARNTAG __FILE__ << '@' << __LINE__ << ": warning" -#define CXZ_ERROR(errmsg) {\ + +/** throw error + @param errmsg error message + */ +#define CXZ_ERROR(errmsg) { \ auto mkerr = [&](){ std::stringstream ss; ss << CXZ_ERRTAG << ": " << errmsg << std::flush; return ss.str(); }; \ throw std::runtime_error(mkerr()); } +/** print warning + @param errmsg warning message + */ #define CXZ_WARNING(errmsg) {\ std::cerr << CXZ_WARNTAG << ": " << errmsg << std::endl; } +/** throw error if given statement is not fulfilled + @param statement statement to be checked + @param errmsg error message + */ #define CXZ_ASSERT(statement, errmsg) if(not (statement)) { CXZ_ERROR(errmsg); } diff --git a/src/include/base/base.cc.h b/src/include/base/base.cc.h index 908c559..099a0d7 100644 --- a/src/include/base/base.cc.h +++ b/src/include/base/base.cc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/base.cc.h diff --git a/src/include/base/base.h b/src/include/base/base.h index 8f6611b..8e2c0b9 100644 --- a/src/include/base/base.h +++ b/src/include/base/base.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/base.h diff --git a/src/include/base/config.h b/src/include/base/config.h index 857da7b..a4224e8 100644 --- a/src/include/base/config.h +++ b/src/include/base/config.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/config.h @@ -20,10 +21,13 @@ namespace CNORXZ { namespace Config { + /** return cnorxz version */ String version(); + /** return git hash */ String commit(); + /** return compile flags */ String flags(); } } diff --git a/src/include/base/dtype.cc.h b/src/include/base/dtype.cc.h index 067b90d..ad1f34a 100644 --- a/src/include/base/dtype.cc.h +++ b/src/include/base/dtype.cc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/dtype.cc.h diff --git a/src/include/base/dtype.h b/src/include/base/dtype.h index d16ca34..f78b11d 100644 --- a/src/include/base/dtype.h +++ b/src/include/base/dtype.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/dtype.h @@ -24,6 +25,9 @@ namespace CNORXZ { + /** **** + Type erasing class wrapping std::any + */ class DType { private: @@ -38,22 +42,60 @@ namespace CNORXZ void _mkComp(); public: - DEFAULT_MEMBERS(DType); - + DEFAULT_MEMBERS(DType); /**< default constructors and assignments */ + + /** Generic constructor template + + Constructs a DType from the given argument + @tparam T input data type + @param d input + */ template DType(const T& d); + /** Generic assignment template + + Assigns the given argument to the DType + @tparam T input data type + @param d input + */ template DType& operator=(const T& d); + /** convert contained data so string */ String str() const { return mToStr(mD); } + + /** return reference to type-erased data */ const std::any& get() const { return mD; } + /** check for equality + @param a variable to compare with + */ bool operator==(const DType& a) const { return mComp(mD,a.mD) == 0; } + + /** check for inequality + @param a variable to compare with + */ bool operator!=(const DType& a) const { return mComp(mD,a.mD) != 0; } + + /** check smaller + @param a variable to compare with + */ bool operator<(const DType& a) const { return mComp(mD,a.mD) == -1; } + + /** check greater + @param a variable to compare with + */ bool operator>(const DType& a) const { return mComp(mD,a.mD) == 1; } + + /** check not greater + @param a variable to compare with + */ bool operator<=(const DType& a) const { auto c = mComp(mD,a.mD); return c <= 0; } + + /** check not smaller + @param a variable to compare with + */ bool operator>=(const DType& a) const { auto c = mComp(mD,a.mD); return c == 1 or c == 0; } }; diff --git a/src/include/base/isq.h b/src/include/base/isq.h index a89c4b5..3bf3bb4 100644 --- a/src/include/base/isq.h +++ b/src/include/base/isq.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/isq.h @@ -19,6 +20,7 @@ namespace CNORXZ { + /** @cond 0 */ template std::index_sequence<(Is+O)...> mkIsqAdd(std::index_sequence is) { return {}; } @@ -33,7 +35,12 @@ namespace CNORXZ typedef decltype(make()) type; }; + /** @endcond */ + /** static consecutive integer sequence + @tparam B begin integer + @tparam E end integer + */ template using Isqr = typename MkIsq::type; } diff --git a/src/include/base/iter.cc.h b/src/include/base/iter.cc.h index bcd115a..2270df6 100644 --- a/src/include/base/iter.cc.h +++ b/src/include/base/iter.cc.h @@ -1,3 +1,13 @@ +// -*- C++ -*- +/** + + @file include/base/iter.cc.h + @brief Static for-loops + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_iter_cc_h__ #define __cxz_iter_cc_h__ @@ -7,6 +17,7 @@ namespace CNORXZ { + /** @cond 0 */ template constexpr decltype(auto) iteri(const G& g, const F& f, Isq is) { @@ -17,6 +28,7 @@ namespace CNORXZ return f( g(CSizeT{}) ... ); } } + /** @endcond */ template constexpr decltype(auto) iter(const G& g, const F& f) @@ -24,6 +36,7 @@ namespace CNORXZ return iteri(g, f, Isqr{}); } + /** @cond 0 */ template constexpr decltype(auto) iterIfi(const G& g, const F& f, const C& c, const Args&... args) { @@ -44,6 +57,7 @@ namespace CNORXZ } } } + /** @endcond */ template constexpr decltype(auto) iterIf(const G& g, const F& f, const C& c) diff --git a/src/include/base/iter.h b/src/include/base/iter.h index 8d3d303..183e94f 100644 --- a/src/include/base/iter.h +++ b/src/include/base/iter.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/iter.h @@ -18,15 +19,37 @@ namespace CNORXZ { + /** @cond 0 */ template constexpr decltype(auto) iteri(const G& g, const F& f, Isq is); - + /** @endcond */ + + /** static for loop + @tparam B begin index + @tparam E end index + @tparam G type of expression to executed for each element + @tparam F type of accumulating expression collecting result for all elements + @param g expression to executed for each element + @param f accumulating expression collecting result for all elements + */ template constexpr decltype(auto) iter(const G& g, const F& f); + /** @cond 0 */ template constexpr decltype(auto) iterIfi(const G& g, const F& f, const C& c, const Args&... args); + /** @endcond */ + /** static conditional for loop + @tparam B begin index + @tparam E end index + @tparam G type of expression to executed for each element + @tparam F type of accumulating expression collecting result for all elements + @tparam C type of condition expression + @param g expression to executed for each element + @param f accumulating expression collecting result for all elements + @param c condition expression + */ template constexpr decltype(auto) iterIf(const G& g, const F& f, const C& c); } diff --git a/src/include/base/macros.h b/src/include/base/macros.h index 7df2153..ffe36d0 100644 --- a/src/include/base/macros.h +++ b/src/include/base/macros.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/macros.h @@ -24,26 +25,90 @@ << " in " << __func__ << ": " << #a << " = " << a << std::endl; #endif +/** shortcut for defining default constructor */ #define DEFAULT_C(__class_name__) __class_name__() = default + +/** shortcut for defining default copy constructor */ #define DEFAULT_COPY_C(__class_name__) __class_name__(const __class_name__& a) = default + +/** shortcut for defining default copy assignment */ #define DEFAULT_COPY_A(__class_name__) __class_name__& operator=(const __class_name__& a) = default + +/** shortcut for defining default move constructor */ #define DEFAULT_MOVE_C(__class_name__) __class_name__(__class_name__&& a) = default + +/** shortcut for defining default move assignment */ #define DEFAULT_MOVE_A(__class_name__) __class_name__& operator=(__class_name__&& a) = default + +/** shortcut for defining default copy constructor and assignment */ #define DEFAULT_COPY(__class_name__) DEFAULT_COPY_C(__class_name__); DEFAULT_COPY_A(__class_name__) + +/** shortcut for defining default move constructor and assignment */ #define DEFAULT_MOVE(__class_name__) DEFAULT_MOVE_C(__class_name__); DEFAULT_MOVE_A(__class_name__) + +/** shortcut for defining default copy and move constructor and assignment */ #define DEFAULT_MEMBERS_X(__class_name__) DEFAULT_COPY(__class_name__); DEFAULT_MOVE(__class_name__) + +/** shortcut for defining default constructor, default copy and move constructor and assignment */ #define DEFAULT_MEMBERS(__class_name__) DEFAULT_C(__class_name__); DEFAULT_MEMBERS_X(__class_name__) +/** shortcut for defining default constructor + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_C(__spec__,__class_name__) __spec__ __class_name__() = default + +/** shortcut for defining default copy constructor + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_COPY_C(__spec__,__class_name__) __spec__ __class_name__(const __class_name__& a) = default + +/** shortcut for defining default copy assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_COPY_A(__spec__,__class_name__) __spec__ __class_name__& operator=(const __class_name__& a) = default + +/** shortcut for defining default move constructor + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_MOVE_C(__spec__,__class_name__) __spec__ __class_name__(__class_name__&& a) = default + +/** shortcut for defining default move assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_MOVE_A(__spec__,__class_name__) __spec__ __class_name__& operator=(__class_name__&& a) = default + +/** shortcut for defining default copy constructor and assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_COPY(__spec__,__class_name__) SP_DEFAULT_COPY_C(__spec__,__class_name__); SP_DEFAULT_COPY_A(__spec__,__class_name__) + +/** shortcut for defining default move constructor and assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_MOVE(__spec__,__class_name__) SP_DEFAULT_MOVE_C(__spec__,__class_name__); SP_DEFAULT_MOVE_A(__spec__,__class_name__) + +/** shortcut for defining default copy and move constructor and assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_MEMBERS_X(__spec__,__class_name__) SP_DEFAULT_COPY(__spec__,__class_name__); SP_DEFAULT_MOVE(__spec__,__class_name__) + +/** shortcut for defining default constructor, default copy and move constructor and assignment + @param __spec__ specifier + @param __class_name__ class name + */ #define SP_DEFAULT_MEMBERS(__spec__,__class_name__) SP_DEFAULT_C(__spec__,__class_name__); SP_DEFAULT_MEMBERS_X(__spec__,__class_name__) +/** shortcut for all typedefs needed to use a class as iterator + @param __meta_type__ meta data type + */ #define INDEX_RANDOM_ACCESS_ITERATOR_DEFS(__meta_type__) typedef std::random_access_iterator_tag iterator_category; \ typedef SizeT difference_type; \ typedef __meta_type__ value_type; \ diff --git a/src/include/base/obj_handle.cc.h b/src/include/base/obj_handle.cc.h index 8942e57..a72a498 100644 --- a/src/include/base/obj_handle.cc.h +++ b/src/include/base/obj_handle.cc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/obj_handle.cc.h diff --git a/src/include/base/obj_handle.h b/src/include/base/obj_handle.h index 11ac328..02b2b19 100644 --- a/src/include/base/obj_handle.h +++ b/src/include/base/obj_handle.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/obj_handle.h @@ -19,24 +20,62 @@ namespace CNORXZ { + /** **** + unique pointer wrapper + + Allows to handle objects accessed through abstract base class pointers + as if they were complete (non-virtual) types. + Each type to be handled is required to have a copy() member function + that returns a copy of itself + + @tparam T object type + */ template class ObjHandle { protected: - Uptr mC; + Uptr mC; /**< pointer to the object data */ public: + /** default constructor */ ObjHandle(); + + /** construct from unique pointer + @param a unique pointer + */ ObjHandle(Uptr&& a); + + /** copy construct + @param a input + */ ObjHandle(const ObjHandle& a); + + /** move construct + @param a input + */ ObjHandle(ObjHandle&& a); + + /** copy assign + @param a input + */ ObjHandle& operator=(const ObjHandle& a); + + /** move assign + @param a input + */ ObjHandle& operator=(ObjHandle&& a); + /** access data */ T& operator*(); + + /** get pointer to data */ T* operator->(); + + /** access data (const) */ const T& operator*() const; + + /** get pointer to data (const) */ const T* operator->() const; }; diff --git a/src/include/base/to_string.cc.h b/src/include/base/to_string.cc.h index c75f073..3d31a08 100644 --- a/src/include/base/to_string.cc.h +++ b/src/include/base/to_string.cc.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/to_string.cc.h diff --git a/src/include/base/to_string.h b/src/include/base/to_string.h index 53024d3..c64711f 100644 --- a/src/include/base/to_string.h +++ b/src/include/base/to_string.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/to_string.h @@ -17,48 +18,101 @@ namespace CNORXZ { + /** *** + Generic cast to string + @tparam T type to be casted + */ template struct ToString { + /** cast to string + @param a object to be casted + */ static String func(const T& a); }; + /** *** + Specialization of ToString for strings + */ template <> struct ToString { + /** cast to string + @param a string to be casted + */ static String func(const String& a); }; + /** *** + Specialization of ToString for vectors + @tparam T vector element type + */ template struct ToString> { + /** cast to string + @param a vector to be casted + */ static String func(const Vector& a); }; + /** *** + Specialization of ToString for arrays + @tparam T array element type + @tparam N array size + */ template struct ToString> { + /** cast to string + @param a array to be casted + */ static String func(const Arr& a); }; + /** *** + Specialization of ToString for tuples + @tparam Ts tuple element types + */ template struct ToString> { + /** cast to string + @param a tuple to be casted + */ static String func(const Tuple& t); }; + /** *** + Specialization of ToString for pairs + @tparam T first element type + @tparam S second element type + */ template struct ToString> { + /** cast to string + @param a pair to be casted + */ static String func(const std::pair& t); }; + /** *** + Specialization of ToString for DType + */ template <> struct ToString { + /** cast to string + @param a DType to be casted + */ static String func(const DType& a); }; + /** wrapper function for ToString + @tparam T type to be casted + @param a object to be casted + */ template String toString(const T& a); diff --git a/src/include/base/types.h b/src/include/base/types.h index f1561fa..8af8b40 100644 --- a/src/include/base/types.h +++ b/src/include/base/types.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/types.h diff --git a/src/include/base/utils.h b/src/include/base/utils.h index a1fc709..1da3aa6 100644 --- a/src/include/base/utils.h +++ b/src/include/base/utils.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/utils.h diff --git a/src/include/base/uuid.h b/src/include/base/uuid.h index 8e30352..df8da17 100644 --- a/src/include/base/uuid.h +++ b/src/include/base/uuid.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** @file include/base/uuid.h @@ -16,39 +17,67 @@ namespace CNORXZ { + /** *** + uuid + */ struct Uuid { - uint64_t i1; - uint64_t i2; + uint64_t i1; /**< first 8 bytes */ + uint64_t i2; /**< second 8 bytes */ }; + /** create new uuid */ Uuid mkUuid(); + /** operator equal to + @param a left hand side + @param b right hand side + */ inline bool operator==(const Uuid& a, const Uuid& b) { return a.i1 == b.i1 and a.i2 == b.i2; } + /** operator not equal to + @param a left hand side + @param b right hand side + */ inline bool operator!=(const Uuid& a, const Uuid& b) { return a.i1 != b.i1 or a.i2 != b.i2; } + /** operator less than + @param a left hand side + @param b right hand side + */ inline bool operator<(const Uuid& a, const Uuid& b) { return (a.i1 == b.i1) ? a.i2 < b.i2 : a.i1 < b.i1; } + /** operator greater than + @param a left hand side + @param b right hand side + */ inline bool operator>(const Uuid& a, const Uuid& b) { return (a.i1 == b.i1) ? a.i2 > b.i2 : a.i1 > b.i1; } + /** operator less or equal + @param a left hand side + @param b right hand side + */ inline bool operator<=(const Uuid& a, const Uuid& b) { return not( (a.i1 == b.i1) ? a.i2 > b.i2 : a.i1 > b.i1 ); } + /** operator greater or equal + @param a left hand side + @param b right hand side + */ inline bool operator>=(const Uuid& a, const Uuid& b) { return not( (a.i1 == b.i1) ? a.i2 < b.i2 : a.i1 < b.i1 ); diff --git a/src/include/ranges/crange.h b/src/include/ranges/crange.h index 3cbf138..5675b3f 100644 --- a/src/include/ranges/crange.h +++ b/src/include/ranges/crange.h @@ -20,6 +20,9 @@ namespace CNORXZ { + /** **** + specific index for CRange + */ class CIndex : public IndexInterface { public: @@ -29,46 +32,82 @@ namespace CNORXZ typedef SizeT MetaType; INDEX_RANDOM_ACCESS_ITERATOR_DEFS(MetaType); - DEFAULT_MEMBERS(CIndex); + DEFAULT_MEMBERS(CIndex); /**< default constructors and assignments */ + + /** constrcut index from range and position + @param range Range to iterate over + @param pos lexicographic position + */ CIndex(const RangePtr& range, SizeT pos = 0); - + + /** @copydoc IndexInterface::operator=(SizeT) */ CIndex& operator=(SizeT lexpos); + + /** @copydoc IndexInterface::operator++() */ CIndex& operator++(); + + /** @copydoc IndexInterface::operator--() */ CIndex& operator--(); + + /** @copydoc IndexInterface::operator+() */ CIndex operator+(Int n) const; + + /** @copydoc IndexInterface::operator-() */ CIndex operator-(Int n) const; + + /** @copydoc IndexInterface::operator-(CIndex) */ SizeT operator-(const CIndex& i) const; + + /** @copydoc IndexInterface::operator+=() */ CIndex& operator+=(Int n); + + /** @copydoc IndexInterface::operator-=() */ CIndex& operator-=(Int n); + /** @copydoc IndexInterface::lex() */ SizeT lex() const; + + /** @copydoc IndexInterface::pmax() */ UPos pmax() const; + + /** @copydoc IndexInterface::lmax() */ UPos lmax() const; + + /** @copydoc IndexInterface::id() */ IndexId<0> id() const; + /** @copydoc IndexInterface::operator*() */ SizeT operator*() const; + /** @copydoc IndexInterface::dim() */ SizeT dim() const; // = 1 + + /** @copydoc IndexInterface::range() */ Sptr range() const; + /** @copydoc IndexInterface::stepSize() */ template decltype(auto) stepSize(const IndexId& id) const; + /** @copydoc IndexInterface::stringMeta() */ String stringMeta() const; + + /** @copydoc IndexInterface::meta() */ SizeT meta() const; + + /** @copydoc IndexInterface::at() */ CIndex& at(const SizeT& metaPos); + + /** @copydoc IndexInterface::xpr() */ COpRoot xpr(const Sptr& _this) const; + /** @copydoc IndexInterface::prange() */ RangePtr prange(const CIndex& last) const; + /** @copydoc IndexInterface::deepFormat() */ SizeT deepFormat() const; - /* - template - decltype(auto) formatFrom(const Index& ind) const; - template - decltype(auto) slice(const Sptr& ind) const; - */ + /** @copydoc IndexInterface::ifor() */ template decltype(auto) ifor(const Xpr& xpr, F&& f) const; @@ -76,15 +115,31 @@ namespace CNORXZ Sptr mRangePtr; }; + /** make index pack of a CIndex and another index + @tparam type of the second index + @param a pointer to CIndex + @param b pointer to another index + */ template decltype(auto) operator*(const Sptr& a, const Sptr& b); + /** **** + specific factory for CRange + */ class CRangeFactory : public RangeFactoryBase { public: typedef CRange oType; + /** construct and setup factory + @param size size of the range to be constructed + */ CRangeFactory(SizeT size); + + /** construct and setup factory + @param size size of the range to be constructed + @param ref range the range to be constructed is related to + */ CRangeFactory(SizeT size, RangePtr ref); protected: @@ -95,6 +150,12 @@ namespace CNORXZ RangePtr mRef; }; + /** **** + Classic Range + The parameter space is given by a + set of positve integer numbers running + form 0 to size-1 + */ class CRange : public RangeInterface { public: @@ -112,25 +173,43 @@ namespace CNORXZ virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; + /** return meta data at given position + @param pos position, size type + */ SizeT get(SizeT pos) const; + + /** return position for given meta data + @param metaPos meta data, size type + */ SizeT getMeta(SizeT metaPos) const; protected: + /** default constructor */ CRange() = default; + CRange(const CRange& in) = delete; + + /** create range of given size + @param size, input size, size type + */ CRange(SizeT size); virtual Vector key() const override final; - SizeT mSize = 0; + SizeT mSize = 0; /**< range size */ SERIALIZATION_FUNCTIONS_NOPUB; }; + /** *** + Specialize RangeCast for casts to CRange + @see RangeCast + */ template <> struct RangeCast { + /** cast the range */ static Sptr func(const RangePtr& r); }; } diff --git a/src/include/ranges/index_base.h b/src/include/ranges/index_base.h index b8c21b9..71d8a92 100644 --- a/src/include/ranges/index_base.h +++ b/src/include/ranges/index_base.h @@ -110,27 +110,27 @@ namespace CNORXZ */ bool operator==(const IndexInterface& i) const; - /** check if indices are non-equal + /** check if indices are not equal @param i Index to compare with */ bool operator!=(const IndexInterface& i) const; - /** check if index is smaller than i + /** check if index position is less than that of i @param i Index to compare with */ bool operator<(const IndexInterface& i) const; - /** check if index is greater than i + /** check if index position is greater than that of i @param i Index to compare with */ bool operator>(const IndexInterface& i) const; - /** check if index is not greater than i + /** check if index position is less or equal than that of i @param i Index to compare with */ bool operator<=(const IndexInterface& i) const; - /** check if index is not smaller than i + /** check if index position is greater or equal than that of i @param i Index to compare with */ bool operator>=(const IndexInterface& i) const; diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index b75b4b9..84a5020 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -399,17 +399,7 @@ namespace CNORXZ ( [&](auto i) { return mIPack[i]->stepSize(id) * format()[i]; }, [](const auto&... ss) { return ( ss + ... ); }); } - /* - template - template - decltype(auto) GMIndex::formatFrom(const Index& ind) const - { - static_assert(is_index::value, "got non-index"); - CXZ_ASSERT(ind.dim() >= dim(), "for formatting index of dimension " << dim() - << " need index of at least the same dimension, got " << ind.dim()); - return *this; - } - */ + template String GMIndex::stringMeta() const { diff --git a/src/include/ranges/mrange.h b/src/include/ranges/mrange.h index df0c9b5..f805ad1 100644 --- a/src/include/ranges/mrange.h +++ b/src/include/ranges/mrange.h @@ -74,9 +74,6 @@ namespace CNORXZ template decltype(auto) stepSize(const IndexId& id) const; - //template - //decltype(auto) formatFrom(const Index& ind) const; - String stringMeta() const; MetaType meta() const; GMIndex& at(const MetaType& metaPos); diff --git a/src/lib/ranges/crange.cc b/src/lib/ranges/crange.cc index af4557f..4e95cd3 100644 --- a/src/lib/ranges/crange.cc +++ b/src/lib/ranges/crange.cc @@ -5,10 +5,10 @@ namespace CNORXZ { - /*************** - * CIndex * - ***************/ - + /*=====================================================+ + | Implementations of member functions of CIndex | + +=====================================================*/ + CIndex::CIndex(const RangePtr& range, SizeT pos) : IndexInterface(pos), mRangePtr(rangeCast(range)) {} @@ -139,9 +139,9 @@ namespace CNORXZ return 1; } - /********************** - * CRangeFactory * - **********************/ + /*============================================================+ + | Implementations of member functions of CRangeFactory | + +============================================================*/ CRangeFactory::CRangeFactory(SizeT size) : mSize(size) {} @@ -162,9 +162,9 @@ namespace CNORXZ } } - /*************** - * CRange * - ***************/ + /*=====================================================+ + | Implementations of member functions of CRange | + +=====================================================*/ CRange::CRange(SizeT size) : mSize(size) {} @@ -214,9 +214,9 @@ namespace CNORXZ return Vector { this->id() }; } - /******************* - * Range Casts * - *******************/ + /*======================================+ + | Implementations of range casts | + +======================================*/ Sptr RangeCast::func(const RangePtr& r) { diff --git a/src/tests/test_header.h b/src/tests/test_header.h deleted file mode 100644 index f41d3a1..0000000 --- a/src/tests/test_header.h +++ /dev/null @@ -1,114 +0,0 @@ - - -#include -#include "gtest/gtest.h" -#include - -#include "cnorxz.h" - -#include -#include - -namespace MAT = CNORXZ; - -double xround(double arg) -{ - if(std::isnan(arg)) { return 0.; } - return roundf(arg * 100000.) / 100000.; -} - -using namespace MAT; - -typedef ClassicRange CR; -typedef ClassicRF CRF; -typedef DynamicRange DR; -typedef DynamicRangeFactory DRF; - -template -void swapFactory(std::shared_ptr& fptr) -{ - auto nptr = std::make_shared(); - fptr = nptr; -} - -template -void swapFactory(std::shared_ptr& fptr, std::initializer_list ilist) -{ - vector tmp = ilist; - auto nptr = std::make_shared( tmp ); - fptr = nptr; -} - -template -void swapFactory(std::shared_ptr& fptr, vector& ilist) -{ - vector tmp = ilist; - auto nptr = std::make_shared( tmp ); - fptr = nptr; -} - - -template -void swapMFactory(std::shared_ptr& fptr, const Rs&... rs) -{ - auto nptr = std::make_shared( rs... ); - fptr = nptr; -} - -template -auto mkt(Ts&&... ts) -> decltype(std::make_tuple(ts...)) -{ - return std::make_tuple(ts...); -} - -template -auto mkts(Ts&&... ts) -> decltype(std::make_tuple(ts...)) -{ - return std::make_tuple(static_cast( ts )...); -} - -//typedef Expressions1 EC1; - -template -struct Pow -{ - static constexpr bool FISSTATIC = true; - typedef T value_type; - - static inline T apply(T b, T e) - { - return pow(b, e); - } - - template - static auto mk(const Ops&... ops) - -> Operation,Ops...> - { - return Operation,Ops...>(ops...); - } - - static inline T apply(const std::tuple& arg) - { - return pow(std::get<0>(arg), std::get<1>(arg)); - } -}; - - -template -struct Monopole -{ - static constexpr bool FISSTATIC = true; - - static inline T apply(T f0, T x, T n) - { - return f0 / ( 1 + x / n ); - } - - template - static auto mk(const Ops&... ops) - -> Operation,Ops...> - { - return Operation,Ops...>(ops...); - } -}; -