cnorxz/src/include/ranges/xindex.cc.h
Christian Zimmermann b0d002b7b1 re-enable index ifor
2022-10-16 23:05:48 +02:00

165 lines
3.5 KiB
C++

#ifndef __cxz_xindex_cc_h__
#define __cxz_xindex_cc_h__
#include "xindex.h"
namespace CNORXZ
{
/**************
* XIndex *
**************/
template <class Index, typename Meta>
XIndex<Index,Meta>::XIndex(const IndexPtr<Index,Meta>& i) :
mI(i) {}
template <class Index, typename Meta>
XIndex<Index,Meta>::XIndex(const IndexInterface<Index,Meta>& i) :
mI(std::make_shared<Index>(i.THIS())) {}
template <class Index, typename Meta>
XIndexPtr XIndex<Index,Meta>::copy() const
{
return std::make_shared<XIndex<Index,Meta>>(mI->THIS());
}
template <class Index, typename Meta>
SizeT XIndex<Index,Meta>::pos() const
{
return mI->pos();
}
template <class Index, typename Meta>
XIndex<Index,Meta>& XIndex<Index,Meta>::operator=(SizeT pos)
{
*mI = pos;
return *this;
}
template <class Index, typename Meta>
XIndex<Index,Meta>& XIndex<Index,Meta>::operator++()
{
++(*mI);
return *this;
}
template <class Index, typename Meta>
XIndex<Index,Meta>& XIndex<Index,Meta>::operator--()
{
--(*mI);
return *this;
}
template <class Index, typename Meta>
Sptr<XIndexBase> XIndex<Index,Meta>::operator+(Int n) const
{
return std::make_shared<XIndex<Index,Meta>>(*mI + n);
}
template <class Index, typename Meta>
Sptr<XIndexBase> XIndex<Index,Meta>::operator-(Int n) const
{
return std::make_shared<XIndex<Index,Meta>>(*mI - n);
}
template <class Index, typename Meta>
XIndex<Index,Meta>& XIndex<Index,Meta>::operator+=(Int n)
{
(*mI) += n;
return *this;
}
template <class Index, typename Meta>
XIndex<Index,Meta>& XIndex<Index,Meta>::operator-=(Int n)
{
(*mI) -= n;
return *this;
}
template <class Index, typename Meta>
SizeT XIndex<Index,Meta>::max() const
{
return mI->max();
}
template <class Index, typename Meta>
IndexId<0> XIndex<Index,Meta>::id() const
{
return IndexId<0>(mI->id().id());
}
template <class Index, typename Meta>
DType XIndex<Index,Meta>::operator*() const
{
return DType(*(*mI));
}
template <class Index, typename Meta>
DType XIndex<Index,Meta>::operator->() const
{
return DType(*(*mI));
}
template <class Index, typename Meta>
Int XIndex<Index,Meta>::pp(PtrId idxPtrNum)
{
Int out = mI->pp(idxPtrNum);
return out;
}
template <class Index, typename Meta>
Int XIndex<Index,Meta>::mm(PtrId idxPtrNum)
{
Int out = mI->mm(idxPtrNum);
return out;
}
template <class Index, typename Meta>
SizeT XIndex<Index,Meta>::dim() const
{
return mI->dim();
}
template <class Index, typename Meta>
RangePtr XIndex<Index,Meta>::range() const
{
return mI->range();
}
template <class Index, typename Meta>
UPos XIndex<Index,Meta>::stepSize(const IndexId<0>& id) const
{
return mI->stepSize(id);
}
template <class Index, typename Meta>
String XIndex<Index,Meta>::stringMeta() const
{
return mI->stringMeta();
}
template <class Index, typename Meta>
DType XIndex<Index,Meta>::meta() const
{
return DType(mI->meta());
}
template <class Index, typename Meta>
XIndexBase& XIndex<Index,Meta>::at(const DType& meta)
{
// check!!!
mI->at(std::any_cast<const Meta&>(meta.get()));
return *this;
}
template <class Index, typename Meta>
DXpr XIndex<Index,Meta>::ifor(const UPos& step, const DXpr& xpr) const
{
return DXpr(mI->ifor(step, xpr));
}
}
#endif