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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-09-13 00:31:12 +02:00
|
|
|
SizeT XIndex<Index,Meta>::getStepSize(SizeT n) const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
return mI->getStepSize(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2022-09-15 16:45:45 +02:00
|
|
|
/*
|
2022-09-11 02:48:30 +02:00
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
DExpr XIndex<Index,Meta>::ifor(SizeT step, DExpr ex) const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
return mI->ifor(step, ex);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class Index, typename Meta>
|
2022-09-13 00:31:12 +02:00
|
|
|
DExpr XIndex<Index,Meta>::iforh(SizeT step, DExpr ex) const
|
2022-09-11 02:48:30 +02:00
|
|
|
{
|
|
|
|
return mI->iforh(step, ex);
|
|
|
|
}
|
2022-09-15 16:45:45 +02:00
|
|
|
*/
|
2022-09-11 02:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|