ranges: add stype()

This commit is contained in:
Christian Zimmermann 2024-10-30 18:04:10 -07:00
parent b4ab639747
commit 1e4daf8691
17 changed files with 69 additions and 12 deletions

View file

@ -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

View file

@ -772,6 +772,12 @@ namespace CNORXZ
return (this->begin()+pos).stringMeta();
}
template <class... Ranges>
String MRange<Ranges...>::stype() const
{
return "M";
}
template <class... Ranges>
const TypeInfo& MRange<Ranges...>::type() const
{

View file

@ -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;

View file

@ -320,6 +320,12 @@ namespace CNORXZ
return mRange->stringMeta( mParts[pos] );
}
template <class RangeT>
String PRange<RangeT>::stype() const
{
return "P";
}
template <class RangeT>
const TypeInfo& PRange<RangeT>::type() const
{

View file

@ -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;

View file

@ -118,7 +118,7 @@ namespace CNORXZ
*/
virtual MArray<RangePtr> 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;

View file

@ -294,6 +294,12 @@ namespace CNORXZ
return toString(mSpace[pos]);
}
template <typename MetaType, SizeT S>
String SRange<MetaType,S>::stype() const
{
return "S";
}
template <typename MetaType, SizeT S>
const TypeInfo& SRange<MetaType,S>::type() const
{

View file

@ -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;

View file

@ -326,6 +326,12 @@ namespace CNORXZ
return toString(this->get(pos));
}
template <typename MetaT>
String URange<MetaT>::stype() const
{
return "U";
}
template <typename MetaT>
const TypeInfo& URange<MetaT>::type() const
{

View file

@ -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;

View file

@ -356,6 +356,12 @@ namespace CNORXZ
return toString(this->get(pos));
}
template <typename MetaT>
String WRange<MetaT>::stype() const
{
return "W";
}
template <typename MetaT>
const TypeInfo& WRange<MetaT>::type() const
{

View file

@ -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;

View file

@ -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;

View file

@ -225,6 +225,11 @@ namespace CNORXZ
return toString(pos);
}
String CRange::stype() const
{
return "C";
}
const TypeInfo& CRange::type() const
{
return typeid(CRange);

View file

@ -629,6 +629,11 @@ namespace CNORXZ
return out;
}
String YRange::stype() const
{
return "Y";
}
const TypeInfo& YRange::type() const
{
return typeid(YRange);

View file

@ -606,6 +606,12 @@ namespace CNORXZ
return (this->begin()+pos).stringMeta();
}
template <class RangeI, class RangeK>
String RRange<RangeI,RangeK>::stype() const
{
return "R";
}
template <class RangeI, class RangeK>
const TypeInfo& RRange<RangeI,RangeK>::type() const
{

View file

@ -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;