From c9f7407de8a369c67a9a2be837d26fef48877e32 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Fri, 3 Nov 2023 02:01:01 +0100 Subject: [PATCH] WIP: doxygen + remove unused code --- doc/doxy/Doxyfile | 10 +-- src/include/base/dtype.cc.h | 11 +++ src/include/base/dtype.h | 11 +++ src/include/base/isq.h | 11 +++ src/include/base/iter.h | 11 +++ src/include/base/obj_handle.cc.h | 11 +++ src/include/base/obj_handle.h | 14 +++- src/include/base/to_string.cc.h | 11 +++ src/include/base/to_string.h | 11 +++ src/include/base/utils.h | 9 +++ src/include/base/uuid.h | 10 ++- src/include/cnorxz.h | 22 ++++++ src/include/ranges/range_base.h | 129 ++++++++++++++++++++++++++----- src/include/ranges/urange.cc.h | 19 ----- src/include/ranges/urange.h | 6 -- src/lib/ranges/range_base.cc | 8 -- 16 files changed, 242 insertions(+), 62 deletions(-) diff --git a/doc/doxy/Doxyfile b/doc/doxy/Doxyfile index 92a0bac..22ad033 100644 --- a/doc/doxy/Doxyfile +++ b/doc/doxy/Doxyfile @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "My Project" +PROJECT_NAME = "CNORXZ" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -54,7 +54,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = "Container with Native Operation Routines (by XZ)" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -1343,7 +1343,7 @@ HTML_COLORSTYLE = AUTO_LIGHT # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_HUE = 130 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use gray-scales only. A @@ -1351,7 +1351,7 @@ HTML_COLORSTYLE_HUE = 220 # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_SAT = 200 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 @@ -1362,7 +1362,7 @@ HTML_COLORSTYLE_SAT = 100 # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE_GAMMA = 80 +HTML_COLORSTYLE_GAMMA = 140 # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that diff --git a/src/include/base/dtype.cc.h b/src/include/base/dtype.cc.h index 4b333da..067b90d 100644 --- a/src/include/base/dtype.cc.h +++ b/src/include/base/dtype.cc.h @@ -1,3 +1,14 @@ +/** + + @file include/base/dtype.cc.h + @brief DType template member function definitions + + Definitions of the template member functions of the DType class. + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_dtype_cc_h__ #define __cxz_dtype_cc_h__ diff --git a/src/include/base/dtype.h b/src/include/base/dtype.h index 316d2f7..d16ca34 100644 --- a/src/include/base/dtype.h +++ b/src/include/base/dtype.h @@ -1,3 +1,14 @@ +/** + + @file include/base/dtype.h + @brief DType declaration + + DType is a generic type-erasing class that wrapps std::any. + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_dynamic_meta_h__ #define __cxz_dynamic_meta_h__ diff --git a/src/include/base/isq.h b/src/include/base/isq.h index 5cc6353..a89c4b5 100644 --- a/src/include/base/isq.h +++ b/src/include/base/isq.h @@ -1,3 +1,14 @@ +/** + + @file include/base/isq.h + @brief Integer sequence range and creation functions + + Declaration of integer sequence range and corresponding creating function templates + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_isq_h__ #define __cxz_isq_h__ diff --git a/src/include/base/iter.h b/src/include/base/iter.h index 5ed55dd..8d3d303 100644 --- a/src/include/base/iter.h +++ b/src/include/base/iter.h @@ -1,3 +1,14 @@ +/** + + @file include/base/iter.h + @brief Static for-loops + + Declaration of function templates that can be used to implement a static for-loop + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_iter_h__ #define __cxz_iter_h__ diff --git a/src/include/base/obj_handle.cc.h b/src/include/base/obj_handle.cc.h index 17a58e8..8942e57 100644 --- a/src/include/base/obj_handle.cc.h +++ b/src/include/base/obj_handle.cc.h @@ -1,3 +1,14 @@ +/** + + @file include/base/obj_handle.cc.h + @brief ObjHandle function definition + + Implementation of the member functions of template ObjHandle + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_obj_handle_cc_h__ #define __cxz_obj_handle_cc_h__ diff --git a/src/include/base/obj_handle.h b/src/include/base/obj_handle.h index fe12ed1..11ac328 100644 --- a/src/include/base/obj_handle.h +++ b/src/include/base/obj_handle.h @@ -1,3 +1,15 @@ +/** + + @file include/base/obj_handle.h + @brief ObjHandle template declaration + + Pointer wrapper for directly handling objects via abstract base class; + Provides appropriate copy implementation + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_obj_handle_h__ #define __cxz_obj_handle_h__ @@ -7,8 +19,6 @@ namespace CNORXZ { - // Pointer wrapper for directly handling objects via abstract base class; - // Provides appropriate copy implementation template class ObjHandle { diff --git a/src/include/base/to_string.cc.h b/src/include/base/to_string.cc.h index 34e2adf..c75f073 100644 --- a/src/include/base/to_string.cc.h +++ b/src/include/base/to_string.cc.h @@ -1,3 +1,14 @@ +/** + + @file include/base/to_string.cc.h + @brief String converter implementation + + Implementation of functions that convert a given object/type to a string + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_to_string_cc_h__ #define __cxz_to_string_cc_h__ diff --git a/src/include/base/to_string.h b/src/include/base/to_string.h index f5cd2e5..53024d3 100644 --- a/src/include/base/to_string.h +++ b/src/include/base/to_string.h @@ -1,3 +1,14 @@ +/** + + @file include/base/to_string.h + @brief String converter + + Declaration of functions that convert a given object/type to a string + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_to_string_h__ #define __cxz_to_string_h__ diff --git a/src/include/base/utils.h b/src/include/base/utils.h index 74df958..a1fc709 100644 --- a/src/include/base/utils.h +++ b/src/include/base/utils.h @@ -1,3 +1,12 @@ +/** + + @file include/base/utils.h + @brief utilities + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_utils_h__ #define __cxz_utils_h__ diff --git a/src/include/base/uuid.h b/src/include/base/uuid.h index 30db6cb..8e30352 100644 --- a/src/include/base/uuid.h +++ b/src/include/base/uuid.h @@ -1,8 +1,16 @@ +/** + + @file include/base/uuid.h + @brief uuid implementation + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_uuid_h__ #define __cxz_uuid_h__ -//#include #include #include diff --git a/src/include/cnorxz.h b/src/include/cnorxz.h index 3177ab2..c67f97a 100644 --- a/src/include/cnorxz.h +++ b/src/include/cnorxz.h @@ -1,4 +1,26 @@ // -*- C++ -*- +/** + + @file include/cnorxz.h + @brief cnorxz main header + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ + +/** + @mainpage CNORXZ Documentation + + ## Library organization + + ## Ranges and Indices + + ## Array types + + ## Expressions and Operations + + **/ #ifndef __cxz_cnorxz_h__ #define __cxz_cnorxz_h__ diff --git a/src/include/ranges/range_base.h b/src/include/ranges/range_base.h index 4d4002c..6339881 100644 --- a/src/include/ranges/range_base.h +++ b/src/include/ranges/range_base.h @@ -1,4 +1,16 @@ // -*- C++ -*- +/** + + @file include/range/range_base.h + @brief RangeBase declaration + + Include basic headers containing defintions and macros + used throughout this library + + Copyright (c) 2022 Christian Zimmermann. All rights reserved. + Mail: chizeta@f3l.de + +**/ #ifndef __cxz_range_base_h__ #define __cxz_range_base_h__ @@ -15,75 +27,150 @@ namespace CNORXZ { + /** + Abstract factory base class for creating ranges. + Ranges can exclusively create through range factories. + + All ranges that are ever created are stored in a product map + (sCreated). The object type hash and the uuid of all ranges + the created depends on serve as keys. In the case the range does not + depend on any other range, its own uuid is used as key. If the + range is a result of a cast from another range, the latter's uuid is + used as key. + + Derived factories are supposed to look for an existing range by + calling fromCreated() and, if nullptr returned, add the new range + to the map by calling addToCreated(). These steps are supposed to be + implemented by overloading the purely virtual function make(). + + The product is publicly accessible throught the function create(). + */ class RangeFactoryBase { public: + /** Default constructor */ RangeFactoryBase() = default; + + /** Default destructor */ virtual ~RangeFactoryBase() = default; - + + /** Return the product */ RangePtr create(); - + static RangePtr getRegistered(const TypeInfo& info, const RangePtr& r); // check if range with uuid of r exists; if yes, return existing one, else add r and return it protected: + /** Abstract method to create the product. */ virtual void make() = 0; + /** access the product map (read-only) */ RangePtr fromCreated(const TypeInfo& info, const Vector& rids) const; + + /** add newly created range to the product map */ void addToCreated(const TypeInfo& info, const Vector& rids, const RangePtr& r); - RangePtr mProd; + RangePtr mProd; /**< shared pointer to the product */ private: - // also add single ranges here (PtrId -> own) - // rangeCast: PtrId -> original Range - static Map,RangePtr>> sCreated; + + static Map,RangePtr>> sCreated; /**< the product map */ }; + /** + Abstract range base class + + A range defines a parameter space containers and operations are defined on. + Indices can be used to iterate over that space. + + Ranges have to be created though a corresponding factory. + @see RangeFactoryBase + + Ranges always exist within a shared pointer and cannot be copied. + */ class RangeBase { public: typedef DIndex IndexType; - + + /** default destructor */ virtual ~RangeBase() = default; - // virtual RangePtr sub() const; // Sptr> ; range of subranges (TODO!!!) + /** Access sub-ranges. + In the case the range is multi-dimensional the num-th + sub-range can be accessed through this function + @param num size type argument + */ virtual RangePtr sub(SizeT num) const; + + /** Access sub-ranges. + In the case the range is multi-dimensional this function returns an + array of all sub-ranges (empty is one-dimensional) + */ virtual MArray sub() const; + + /** Range size */ virtual SizeT size() const = 0; + + /** Range dimension. + Returns the range's dimension, which is equivalent to + the number of sub-ranges. If a sub-range has non-zero dimension + this is NOT taken into account! + */ virtual SizeT dim() const = 0; + + /** Range type */ virtual const TypeInfo& type() const = 0; + + /** The type of the range's meta data */ virtual const TypeInfo& metaType() const = 0; + + /** Meta data in string format at lexicographic position pos. + @param pos size type argument + */ virtual String stringMeta(SizeT pos) const = 0; + + /** Return DIndex iterating over the range's parameter space. + @param pos index position, size type argument + */ virtual DIndex index(SizeT pos = 0) const = 0; + + /** Create extended range. + Creates a new range consisting of the meta data spaces + of this range and the range r + @param r shared pointer to range used for extension + */ virtual RangePtr extend(const RangePtr& r) const = 0; - + + /** check if ranges are the same */ bool operator==(const RangeBase& in) const; + + /** check if ranges are not the same */ bool operator!=(const RangeBase& in) const; + /** return the range's uuid */ Uuid id() const; - DIndex begin() const; - DIndex end() const; - RangePtr orig() const; - - //virtual Vector key2() const { return Vector(); } + /** return a DIndex pointing to the range's first element */ + DIndex begin() const; + + /** return a DIndex pointing to the element after the range's last element */ + DIndex end() const; + friend RangeFactoryBase; protected: - - RangeBase(); - RangeBase(const RangePtr& rel); - + /** default constructor */ + RangeBase(); + virtual Vector key() const = 0; // delete copy/move??? - Uuid mId = {0,0}; - Wptr mThis; - RangePtr mRel; // used, if created from another range, to point on it + Uuid mId = {0,0}; /**< The range's uuid */ + Wptr mThis; /**< weak pointer to this range */ }; template diff --git a/src/include/ranges/urange.cc.h b/src/include/ranges/urange.cc.h index 4303c44..b584f58 100644 --- a/src/include/ranges/urange.cc.h +++ b/src/include/ranges/urange.cc.h @@ -175,26 +175,7 @@ namespace CNORXZ return UPos(id == this->id() ? 1 : 0); } } - /* - template - template - decltype(auto) UIndex::formatFrom(const Index& ind) const - { - return *this; - } - template - template - decltype(auto) UIndex::slice(const Sptr& ind) const - { - if(ind != nullptr){ - if(ind->dim() != 0) { - return Sptr>(); - } - } - return std::make_shared>(*this); - } - */ template template decltype(auto) UIndex::ifor(const Xpr& xpr, F&& f) const diff --git a/src/include/ranges/urange.h b/src/include/ranges/urange.h index dc68a84..370ba41 100644 --- a/src/include/ranges/urange.h +++ b/src/include/ranges/urange.h @@ -56,13 +56,7 @@ namespace CNORXZ RangePtr prange(const UIndex& last) const; SizeT deepFormat() const; - /* - template - decltype(auto) formatFrom(const Index& ind) const; - template - decltype(auto) slice(const Sptr& ind) const; - */ template decltype(auto) ifor(const Xpr& xpr, F&& f) const; diff --git a/src/lib/ranges/range_base.cc b/src/lib/ranges/range_base.cc index 3b5d6fb..a90369b 100644 --- a/src/lib/ranges/range_base.cc +++ b/src/lib/ranges/range_base.cc @@ -90,14 +90,6 @@ namespace CNORXZ { return this->index(this->size()); } - - RangePtr RangeBase::orig() const - { - if(mRel) return mRel; - else return RangePtr(mThis); - } - - RangeBase::RangeBase(const RangePtr& rel) : mRel(rel) {} /**************************** * Non-member functions *