2022-09-11 02:48:30 +02:00
|
|
|
|
|
|
|
#ifndef __cxz_xindex_cc_h__
|
|
|
|
#define __cxz_xindex_cc_h__
|
|
|
|
|
|
|
|
#include "xindex.h"
|
|
|
|
|
|
|
|
namespace CNORXZ
|
|
|
|
{
|
2022-09-18 00:49:36 +02:00
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
/**************
|
|
|
|
* XIndex *
|
|
|
|
**************/
|
|
|
|
|
|
|
|
template <class Index, typename Meta>
|
2022-09-18 00:49:36 +02:00
|
|
|
XIndex<Index,Meta>::XIndex(const IndexPtr<Index,Meta>& i) :
|
|
|
|
mI(i) {}
|
2022-09-11 02:48:30 +02:00
|
|
|
|
2022-09-15 16:45:45 +02:00
|
|
|
template <class Index, typename Meta>
|
|
|
|
XIndex<Index,Meta>::XIndex(const IndexInterface<Index,Meta>& i) :
|
|
|
|
mI(std::make_shared<Index>(i.THIS())) {}
|
|
|
|
|
2022-09-18 16:19:27 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
XIndex<Index,Meta>& XIndex<Index,Meta>::operator=(SizeT pos)
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
*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;
|
|
|
|
}
|
|
|
|
|
2022-09-18 00:49:36 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-10-16 23:05:48 +02:00
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2022-09-18 00:49:36 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
Int XIndex<Index,Meta>::pp(PtrId idxPtrNum)
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
2022-09-18 00:49:36 +02:00
|
|
|
Int out = mI->pp(idxPtrNum);
|
|
|
|
return out;
|
2022-09-11 02:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
Int XIndex<Index,Meta>::mm(PtrId idxPtrNum)
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
2022-09-18 00:49:36 +02:00
|
|
|
Int out = mI->mm(idxPtrNum);
|
|
|
|
return out;
|
2022-09-11 02:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
SizeT XIndex<Index,Meta>::dim() const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
return mI->dim();
|
|
|
|
}
|
|
|
|
|
2022-09-18 00:49:36 +02:00
|
|
|
template <class Index, typename Meta>
|
|
|
|
RangePtr XIndex<Index,Meta>::range() const
|
|
|
|
{
|
|
|
|
return mI->range();
|
|
|
|
}
|
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
template <class Index, typename Meta>
|
2022-10-16 23:05:48 +02:00
|
|
|
UPos XIndex<Index,Meta>::stepSize(const IndexId<0>& id) const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
2022-10-16 23:05:48 +02:00
|
|
|
return mI->stepSize(id);
|
2022-09-18 22:50:07 +02:00
|
|
|
}
|
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
String XIndex<Index,Meta>::stringMeta() const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
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>
|
2022-10-16 23:05:48 +02:00
|
|
|
DXpr XIndex<Index,Meta>::ifor(const UPos& step, const DXpr& xpr) const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
2022-10-16 23:05:48 +02:00
|
|
|
return DXpr(mI->ifor(step, xpr));
|
2022-09-11 02:48:30 +02:00
|
|
|
}
|
2022-10-16 23:05:48 +02:00
|
|
|
|
2022-09-11 02:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|