From 1e4daf869137cda427529c5887137a8d189bbbc4 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 30 Oct 2024 18:04:10 -0700 Subject: [PATCH] ranges: add stype() --- src/include/ranges/crange.h | 1 + src/include/ranges/mrange.cc.h | 6 ++++++ src/include/ranges/mrange.h | 1 + src/include/ranges/prange.cc.h | 6 ++++++ src/include/ranges/prange.h | 1 + src/include/ranges/range_base.h | 27 +++++++++++++++------------ src/include/ranges/srange.cc.h | 6 ++++++ src/include/ranges/srange.h | 1 + src/include/ranges/urange.cc.h | 6 ++++++ src/include/ranges/urange.h | 1 + src/include/ranges/wrange.cc.h | 6 ++++++ src/include/ranges/wrange.h | 1 + src/include/ranges/yrange.h | 1 + src/lib/ranges/crange.cc | 5 +++++ src/lib/ranges/yrange.cc | 5 +++++ src/opt/mpi/include/rrange.cc.h | 6 ++++++ src/opt/mpi/include/rrange.h | 1 + 17 files changed, 69 insertions(+), 12 deletions(-) diff --git a/src/include/ranges/crange.h b/src/include/ranges/crange.h index 5a9366e..b9c8166 100644 --- a/src/include/ranges/crange.h +++ b/src/include/ranges/crange.h @@ -178,6 +178,7 @@ namespace CNORXZ virtual String stringMeta(SizeT pos) const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; + virtual String stype() const override final; virtual RangePtr extend(const RangePtr& r) const override final; /** return meta data at given position diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index f431b80..ebf8a5b 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -772,6 +772,12 @@ namespace CNORXZ return (this->begin()+pos).stringMeta(); } + template + String MRange::stype() const + { + return "M"; + } + template const TypeInfo& MRange::type() const { diff --git a/src/include/ranges/mrange.h b/src/include/ranges/mrange.h index 32f2d7c..dfc3833 100644 --- a/src/include/ranges/mrange.h +++ b/src/include/ranges/mrange.h @@ -373,6 +373,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/include/ranges/prange.cc.h b/src/include/ranges/prange.cc.h index 20eb51c..f4ce85c 100644 --- a/src/include/ranges/prange.cc.h +++ b/src/include/ranges/prange.cc.h @@ -320,6 +320,12 @@ namespace CNORXZ return mRange->stringMeta( mParts[pos] ); } + template + String PRange::stype() const + { + return "P"; + } + template const TypeInfo& PRange::type() const { diff --git a/src/include/ranges/prange.h b/src/include/ranges/prange.h index 619d84b..3e20815 100644 --- a/src/include/ranges/prange.h +++ b/src/include/ranges/prange.h @@ -193,6 +193,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/include/ranges/range_base.h b/src/include/ranges/range_base.h index 8019c63..fa58ddd 100644 --- a/src/include/ranges/range_base.h +++ b/src/include/ranges/range_base.h @@ -118,7 +118,7 @@ namespace CNORXZ */ virtual MArray sub() const; - /** Range size */ + /** Range size. */ virtual SizeT size() const = 0; /** Range dimension. @@ -128,42 +128,45 @@ namespace CNORXZ */ virtual SizeT dim() const = 0; - /** Range type */ + /** Range type. */ virtual const TypeInfo& type() const = 0; - /** The type of the range's meta data */ + /** The type of the range's meta data. */ virtual const TypeInfo& metaType() const = 0; + /** String identifier indicating the range's type. */ + virtual String stype() const = 0; + /** Meta data in string format at lexicographic position pos. - @param pos size type argument + @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 + @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 + 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 */ + /** check if ranges are the same. */ bool operator==(const RangeBase& in) const; - /** check if ranges are not the same */ + /** check if ranges are not the same. */ bool operator!=(const RangeBase& in) const; - /** return the range's uuid */ + /** return the range's uuid. */ Uuid id() const; - /** return a DIndex pointing to the range's first element */ + /** 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 */ + /** return a DIndex pointing to the element after the range's last element. */ DIndex end() const; friend RangeFactoryBase; diff --git a/src/include/ranges/srange.cc.h b/src/include/ranges/srange.cc.h index 8a6a33f..04c5ff3 100644 --- a/src/include/ranges/srange.cc.h +++ b/src/include/ranges/srange.cc.h @@ -294,6 +294,12 @@ namespace CNORXZ return toString(mSpace[pos]); } + template + String SRange::stype() const + { + return "S"; + } + template const TypeInfo& SRange::type() const { diff --git a/src/include/ranges/srange.h b/src/include/ranges/srange.h index d03f502..2789f1d 100644 --- a/src/include/ranges/srange.h +++ b/src/include/ranges/srange.h @@ -192,6 +192,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/include/ranges/urange.cc.h b/src/include/ranges/urange.cc.h index 8c20c14..aa2f69f 100644 --- a/src/include/ranges/urange.cc.h +++ b/src/include/ranges/urange.cc.h @@ -326,6 +326,12 @@ namespace CNORXZ return toString(this->get(pos)); } + template + String URange::stype() const + { + return "U"; + } + template const TypeInfo& URange::type() const { diff --git a/src/include/ranges/urange.h b/src/include/ranges/urange.h index 8e3b825..db55795 100644 --- a/src/include/ranges/urange.h +++ b/src/include/ranges/urange.h @@ -181,6 +181,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/include/ranges/wrange.cc.h b/src/include/ranges/wrange.cc.h index f85da66..c14af69 100644 --- a/src/include/ranges/wrange.cc.h +++ b/src/include/ranges/wrange.cc.h @@ -356,6 +356,12 @@ namespace CNORXZ return toString(this->get(pos)); } + template + String WRange::stype() const + { + return "W"; + } + template const TypeInfo& WRange::type() const { diff --git a/src/include/ranges/wrange.h b/src/include/ranges/wrange.h index 363bfc5..e7d8b17 100644 --- a/src/include/ranges/wrange.h +++ b/src/include/ranges/wrange.h @@ -184,6 +184,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/include/ranges/yrange.h b/src/include/ranges/yrange.h index e85a2cf..53a62f6 100644 --- a/src/include/ranges/yrange.h +++ b/src/include/ranges/yrange.h @@ -320,6 +320,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final; diff --git a/src/lib/ranges/crange.cc b/src/lib/ranges/crange.cc index c5123b6..da89ea9 100644 --- a/src/lib/ranges/crange.cc +++ b/src/lib/ranges/crange.cc @@ -225,6 +225,11 @@ namespace CNORXZ return toString(pos); } + String CRange::stype() const + { + return "C"; + } + const TypeInfo& CRange::type() const { return typeid(CRange); diff --git a/src/lib/ranges/yrange.cc b/src/lib/ranges/yrange.cc index ff999cd..57ff714 100644 --- a/src/lib/ranges/yrange.cc +++ b/src/lib/ranges/yrange.cc @@ -628,6 +628,11 @@ namespace CNORXZ } return out; } + + String YRange::stype() const + { + return "Y"; + } const TypeInfo& YRange::type() const { diff --git a/src/opt/mpi/include/rrange.cc.h b/src/opt/mpi/include/rrange.cc.h index bfa6d43..c5a27a4 100644 --- a/src/opt/mpi/include/rrange.cc.h +++ b/src/opt/mpi/include/rrange.cc.h @@ -605,6 +605,12 @@ namespace CNORXZ { return (this->begin()+pos).stringMeta(); } + + template + String RRange::stype() const + { + return "R"; + } template const TypeInfo& RRange::type() const diff --git a/src/opt/mpi/include/rrange.h b/src/opt/mpi/include/rrange.h index c596f8b..956b1b1 100644 --- a/src/opt/mpi/include/rrange.h +++ b/src/opt/mpi/include/rrange.h @@ -270,6 +270,7 @@ namespace CNORXZ virtual SizeT size() const override final; virtual SizeT dim() const override final; virtual String stringMeta(SizeT pos) const override final; + virtual String stype() const override final; virtual const TypeInfo& type() const override final; virtual const TypeInfo& metaType() const override final; virtual RangePtr extend(const RangePtr& r) const override final;