range factory + finishing multi/single range/index changes (except for single range specializations)
This commit is contained in:
parent
5f71b5055d
commit
8db8a07456
8 changed files with 155 additions and 168 deletions
|
@ -26,6 +26,11 @@ namespace MultiArrayTools
|
||||||
return mPos;
|
return mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t IndexBase::max() const
|
||||||
|
{
|
||||||
|
return mRangePtr->size();
|
||||||
|
}
|
||||||
|
|
||||||
operator IndexBase::size_t() const
|
operator IndexBase::size_t() const
|
||||||
{
|
{
|
||||||
return mPos;
|
return mPos;
|
||||||
|
|
|
@ -18,15 +18,13 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DEFAULT_MEMBERS(IndexBase);
|
DEFAULT_MEMBERS(IndexBase);
|
||||||
IndexBase(const RangeBase& range, size_t pos);
|
IndexBase(const std::shared_ptr<RangeBase>& range, size_t pos);
|
||||||
virtual ~IndexBase() = default;
|
virtual ~IndexBase() = default;
|
||||||
|
|
||||||
virtual IndexBase& operator=(size_t pos) = 0;
|
virtual IndexBase& operator=(size_t pos) = 0;
|
||||||
virtual IndexBase& operator++() = 0;
|
virtual IndexBase& operator++() = 0;
|
||||||
virtual IndexBase& operator--() = 0;
|
virtual IndexBase& operator--() = 0;
|
||||||
virtual IndexBase& operator+=(int n) = 0;
|
|
||||||
virtual IndexBase& operator-=(int n) = 0;
|
|
||||||
|
|
||||||
bool operator==(const IndexBase& in) const;
|
bool operator==(const IndexBase& in) const;
|
||||||
bool operator!=(const IndexBase& in) const;
|
bool operator!=(const IndexBase& in) const;
|
||||||
|
|
||||||
|
|
|
@ -398,6 +398,29 @@ namespace MultiArrayTools
|
||||||
PackNum<sizeof...(Indices)-1>::setMeta(mIPack, metaPos);
|
PackNum<sizeof...(Indices)-1>::setMeta(mIPack, metaPos);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************
|
||||||
|
* MultiRangeFactory *
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
MultiRangeFactory<Ranges...>::MultiRangeFactory(const std::shared_ptr<Ranges>&... rs)
|
||||||
|
{
|
||||||
|
mProd = std::make_shared< MultiRange<Ranges...> >( rs... );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
MultiRangeFactory<Ranges...>::MultiRangeFactory(const MultiRange<Ranges...>::SpaceType& st)
|
||||||
|
{
|
||||||
|
mProd = std::make_shared< MultiRange<Ranges...> >( st );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
std::shared_ptr<RangeBase> MultiRangeFactory<Ranges...>::create()
|
||||||
|
{
|
||||||
|
setSelf();
|
||||||
|
return mProd;
|
||||||
|
}
|
||||||
|
|
||||||
/******************
|
/******************
|
||||||
* MultiRange *
|
* MultiRange *
|
||||||
|
@ -422,14 +445,6 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
return PackNum<sizeof...(Ranges)-1>::getSize(mSpace);
|
return PackNum<sizeof...(Ranges)-1>::getSize(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Ranges>
|
|
||||||
MultiRangeType MultiRange<Ranges...>::type() const
|
|
||||||
{
|
|
||||||
std::vector<MultiRangeType> rvec;
|
|
||||||
PackNum<sizeof...(Ranges)-1>::buildRangeVec(rvec, mSpace);
|
|
||||||
return MultiRangeType(rvec);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
const typename MultiRange<Ranges...>::SpaceType& MultiRange<Ranges...>::space() const
|
const typename MultiRange<Ranges...>::SpaceType& MultiRange<Ranges...>::space() const
|
||||||
|
@ -440,26 +455,22 @@ namespace MultiArrayTools
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
MultiIndex<typename Ranges::IndexType...> MultiRange<Ranges...>::begin() const
|
MultiIndex<typename Ranges::IndexType...> MultiRange<Ranges...>::begin() const
|
||||||
{
|
{
|
||||||
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> is;
|
MultiIndex<typename Ranges::IndexType...> i( std::dynamic_pointer_cast<MultiRange<Ranges...> >( mThis ) );
|
||||||
PackNum<sizeof...(Ranges)-1>::setBegin(is,mSpace);
|
return i = 0;
|
||||||
return MultiIndex<typename Ranges::IndexType...>(this, is);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
MultiIndex<typename Ranges::IndexType...> MultiRange<Ranges...>::end() const
|
MultiIndex<typename Ranges::IndexType...> MultiRange<Ranges...>::end() const
|
||||||
{
|
{
|
||||||
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> is;
|
MultiIndex<typename Ranges::IndexType...> i( std::dynamic_pointer_cast<MultiRange<Ranges...> >( mThis ) );
|
||||||
PackNum<sizeof...(Ranges)-1>::setEnd(is,mSpace);
|
return i = size();
|
||||||
return ++MultiIndex<typename Ranges::IndexType...>(this, is);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
std::shared_ptr<IndefinitIndexBase> MultiRange<Ranges...>::indexInstance() const
|
std::shared_ptr<IndexBase> MultiRange<Ranges...>::index() const
|
||||||
{
|
{
|
||||||
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> is;
|
return std::make_shared<MultiIndex<typename Ranges::IndexType...> >
|
||||||
PackNum<sizeof...(Ranges)-1>::setBegin(is,mSpace);
|
( std::dynamic_pointer_cast<MultiRange<Ranges...> >( mThis ) );
|
||||||
std::shared_ptr<IndefinitIndexBase> sptr(new MultiIndex<typename Ranges::IndexType...>(this, is));
|
|
||||||
return sptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,25 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************
|
/*************************
|
||||||
* IndexGetter Functions *
|
* MultiRangeFactory *
|
||||||
****************************/
|
*************************/
|
||||||
|
|
||||||
|
template <class... Ranges>
|
||||||
|
class MultiRangeFactory : public RangeFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MultiRangeFactory() = delete;
|
||||||
|
MultiRangeFactory(const std::shared_ptr<Ranges>&... rs);
|
||||||
|
MultiRangeFactory(const MultiRange<Ranges...>::SpaceType& st);
|
||||||
|
|
||||||
|
virtual std::shared_ptr<RangeBase> create() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************
|
||||||
|
* MultiRange *
|
||||||
|
******************/
|
||||||
|
|
||||||
template <class... Ranges>
|
template <class... Ranges>
|
||||||
class MultiRange : public RangeInterface<MultiIndex<typename Ranges::IndexType...> >
|
class MultiRange : public RangeInterface<MultiIndex<typename Ranges::IndexType...> >
|
||||||
{
|
{
|
||||||
|
@ -89,6 +103,8 @@ namespace MultiArrayTools
|
||||||
virtual typename IndexType end() const override;
|
virtual typename IndexType end() const override;
|
||||||
|
|
||||||
virtual std::shared_ptr<IndexBase> index() const override;
|
virtual std::shared_ptr<IndexBase> index() const override;
|
||||||
|
|
||||||
|
friend MultiRangeFactory<Ranges...>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,14 @@ namespace MultiArrayTools
|
||||||
* RangeBase *
|
* RangeBase *
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
|
bool RangeBase::operator==(const RangeBase& in) const
|
||||||
|
{
|
||||||
|
return this == ∈
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RangeBase::operator!=(const RangeBase& in) const
|
||||||
|
{
|
||||||
|
return this != ∈
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,23 @@ namespace MultiArrayTools
|
||||||
DISTANCE = 8
|
DISTANCE = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RangeFactoryBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RangeFactoryBase() = default;
|
||||||
|
virtual ~RangeFactoryBase() = default;
|
||||||
|
|
||||||
|
// should return mProd !!
|
||||||
|
virtual std::shared_ptr<RangeBase> create() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// call this function before returning product !!
|
||||||
|
void setSelf() { mProd->mThis = mProd; }
|
||||||
|
std::shared_ptr<RangeBase> mProd;
|
||||||
|
};
|
||||||
|
|
||||||
class RangeBase
|
class RangeBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -35,9 +52,16 @@ namespace MultiArrayTools
|
||||||
virtual size_t dim() const = 0;
|
virtual size_t dim() const = 0;
|
||||||
|
|
||||||
virtual std::shared_ptr<IndexBase> index() const = 0;
|
virtual std::shared_ptr<IndexBase> index() const = 0;
|
||||||
|
|
||||||
|
bool operator==(const RangeBase& in) const;
|
||||||
|
bool operator!=(const RangeBase& in) const;
|
||||||
|
|
||||||
|
friend RangeFactoryBase;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
RangeBase() = default;
|
||||||
|
std::shared_ptr<RangeBase> mThis;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Index>
|
template <class Index>
|
||||||
|
@ -49,6 +73,9 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
virtual Index begin() = 0;
|
virtual Index begin() = 0;
|
||||||
virtual Index end() = 0;
|
virtual Index end() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
RangeInterface() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,136 +7,69 @@ namespace MultiArrayTools
|
||||||
* SingleIndex *
|
* SingleIndex *
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>::SingleIndex(const U& upos,
|
template<RangeType TYPE>
|
||||||
std::shared_ptr<const RangeBase<SingleIndex<U,TYPE> > >& rangePtr) :
|
SingleIndex<U>::SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range) :
|
||||||
IndexBase<SingleIndex<U,TYPE> >(rangePtr)
|
IndexInterface<U>(range, 0) {}
|
||||||
{
|
|
||||||
IIB::setPos( dynamic_pointer_cast<const SingleRange<U,TYPE> >( IB::mRangePtr )->get(upos) );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>::SingleIndex(std::shared_ptr<const RangeBase<SingleIndex<U,TYPE> > >& rangePtr,
|
SingleIndex<U>& SingleIndex<U>::operator=(size_t pos)
|
||||||
size_t pos) : IndexBase<SingleIndex<U,TYPE> >(range)
|
|
||||||
{
|
{
|
||||||
IIB::setPos( pos );
|
mPos = pos;
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::operator=(size_t pos)
|
|
||||||
{
|
|
||||||
IIB::setPos( pos );
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::operator++()
|
SingleIndex<U>& SingleIndex<U>::operator++()
|
||||||
{
|
{
|
||||||
IIB::setPos( IIB::pos() + 1 );
|
++mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::operator--()
|
SingleIndex<U>& SingleIndex<U>::operator--()
|
||||||
{
|
{
|
||||||
IIB::setPos( IIB::pos() - 1 );
|
--mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::operator+=(int n)
|
U SingleIndex<U>::meta() const
|
||||||
{
|
|
||||||
IIB::setPos( IIB::pos() + n );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::operator-=(int n)
|
|
||||||
{
|
|
||||||
IIB::setPos( IIB::pos() - n );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
bool SingleIndex<U,TYPE>::operator==(const SingleIndex<U,TYPE>& i)
|
|
||||||
{
|
|
||||||
return IB::mRange == i.mRange and IIB::pos() == static_cast<size_t>( i.mPos );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
bool SingleIndex<U,TYPE>::operator!=(const SingleIndex<U,TYPE>& i)
|
|
||||||
{
|
|
||||||
return IB::mRange != i.mRange or IIB::pos() != static_cast<size_t>( i.mPos );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
MultiRangeType SingleIndex<U,TYPE>::rangeType() const
|
|
||||||
{
|
|
||||||
return MultiRangeType(TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
U SingleIndex<U,TYPE>::getMetaPos() const
|
|
||||||
{
|
{
|
||||||
return dynamic_cast<SingleRange<U,TYPE> const*>( IB::mRange )->get(IIB::pos());
|
return dynamic_cast<SingleRange<U,TYPE> const*>( IB::mRange )->get(IIB::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
SingleIndex<U,TYPE>& SingleIndex<U,TYPE>::atMeta(const U& metaPos)
|
SingleIndex<U>& SingleIndex<U>::at(const U& metaPos)
|
||||||
{
|
{
|
||||||
operator=( dynamic_cast<SingleRange<U,TYPE> const*>( IB::mRange )->getMeta(metaPos) );
|
operator=( dynamic_cast<SingleRange<U,TYPE> const*>( IB::mRange )->getMeta(metaPos) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
size_t SingleIndex<U,TYPE>::dim() const
|
size_t SingleIndex<U>::dim() const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
size_t SingleIndex<U,TYPE>::evaluate(const SingleIndex<U,TYPE>& in) const
|
bool SingleIndex<U>::last() const
|
||||||
{
|
{
|
||||||
return in.pos();
|
return mPos == mRangePtr->size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
void SingleIndex<U,TYPE>::copyPos(const SingleIndex<U,TYPE>& in)
|
bool SingleIndex<U>::first() const
|
||||||
{
|
{
|
||||||
IIB::setPos(in.pos());
|
return mPos == 0;
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
size_t SingleIndex<U,TYPE>::giveSubStepSize(IndefinitIndexBase* subIndex)
|
|
||||||
{
|
|
||||||
if(subIndex == this){
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, VET vet)
|
|
||||||
{
|
|
||||||
os << ( (vet == VET::VALUE) ? std::string("VALUE") : std::string("ERROR") );
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
template <typename U, RangeType TYPE>
|
|
||||||
void SingleIndex<U,TYPE>::eval()
|
|
||||||
{
|
|
||||||
IIB::setPos( evaluate( *this ) );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/********************
|
/********************
|
||||||
* SingleRange *
|
* SingleRange *
|
||||||
********************/
|
********************/
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
SingleRange<U,TYPE>::SingleRange(const std::vector<U>& space) : RangeBase<SingleIndex<U,TYPE> >(),
|
SingleRange<U,TYPE>::SingleRange(const std::vector<U>& space) : RangeBase<SingleIndex<U> >(),
|
||||||
mSpace(space) {}
|
mSpace(space) {}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
|
@ -165,24 +98,34 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
MultiRangeType SingleRange<U,TYPE>::type() const
|
size_t SingleRange<U,TYPE>::dim() const
|
||||||
{
|
{
|
||||||
return MultiRangeType(TYPE);
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// put this in the interface class !!!
|
||||||
|
template <typename U, RangeType TYPE>
|
||||||
|
std::shared_ptr<IndexBase> SingleRange<U,TYPE>::index() const
|
||||||
|
{
|
||||||
|
return std::make_shared<SingleIndex<U> >
|
||||||
|
( std::dynamic_pointer_cast<SingleRange<U,TYPE> >( mThis ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
SingleIndex<U,TYPE> SingleRange<U,TYPE>::begin() const
|
SingleIndex<U> SingleRange<U,TYPE>::begin() const
|
||||||
{
|
{
|
||||||
return SingleIndex<U,TYPE>(this, 0);
|
SingleIndex<U> i(mThis);
|
||||||
|
return i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
SingleIndex<U,TYPE> SingleRange<U,TYPE>::end() const
|
SingleIndex<U> SingleRange<U,TYPE>::end() const
|
||||||
{
|
{
|
||||||
return SingleIndex<U,TYPE>(this, mSpace.size());
|
SingleIndex<U> i(mThis);
|
||||||
|
return i = size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// specializations
|
// specializations (not updated!!!)
|
||||||
|
|
||||||
SingleRange<int,RangeType::SPACE>::SingleRange(size_t ext) :
|
SingleRange<int,RangeType::SPACE>::SingleRange(size_t ext) :
|
||||||
RangeBase<SingleIndex<int,RangeType::SPACE> >(),
|
RangeBase<SingleIndex<int,RangeType::SPACE> >(),
|
||||||
|
|
|
@ -14,69 +14,47 @@
|
||||||
namespace MultiArrayTools
|
namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U>
|
||||||
class SingleIndex : public IndexBase<SingleIndex<U,TYPE> >
|
class SingleIndex : public IndexInterface<U>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef IndexBase<SingleIndex<U,TYPE> > IB;
|
|
||||||
typedef IndefinitIndexBase IIB;
|
|
||||||
|
|
||||||
DEFAULT_MEMBERS(SingleIndex);
|
DEFAULT_MEMBERS(SingleIndex);
|
||||||
|
|
||||||
SingleIndex(const U& upos, std::shared_ptr<const RangeBase<SingleIndex<U,TYPE> > >& rangePtr);
|
template <RangeType TYPE>
|
||||||
|
SingleIndex(const std::shared_ptr<SingleRange<U,TYPE> >& range);
|
||||||
SingleIndex(std::shared_ptr<const RangeBase<SingleIndex<U,TYPE> > >& rangePtr,
|
|
||||||
size_t pos = 0);
|
|
||||||
|
|
||||||
//virtual SingleIndex& operator=(const U& upos);
|
|
||||||
|
|
||||||
virtual SingleIndex& operator=(size_t pos) override;
|
virtual SingleIndex& operator=(size_t pos) override;
|
||||||
virtual SingleIndex& operator++() override;
|
virtual SingleIndex& operator++() override;
|
||||||
virtual SingleIndex& operator--() override;
|
virtual SingleIndex& operator--() override;
|
||||||
virtual SingleIndex& operator+=(int n) override;
|
|
||||||
virtual SingleIndex& operator-=(int n) override;
|
|
||||||
|
|
||||||
virtual bool operator==(const SingleIndex& i);
|
virtual U meta() const;
|
||||||
virtual bool operator!=(const SingleIndex& i);
|
virtual SingleIndex& at(const U& metaPos);
|
||||||
|
|
||||||
virtual MultiRangeType rangeType() const override;
|
|
||||||
|
|
||||||
virtual U getMetaPos() const;
|
|
||||||
virtual SingleIndex& atMeta(const U& metaPos);
|
|
||||||
|
|
||||||
virtual size_t dim() const override; // = 1
|
virtual size_t dim() const override; // = 1
|
||||||
virtual void copyPos(const SingleIndex& in) override;
|
virtual bool last() const override;
|
||||||
|
virtual bool first() const override;
|
||||||
virtual size_t giveSubStepSize(IndefinitIndexBase* subIndex) override;
|
|
||||||
|
|
||||||
//virtual void eval() override;
|
|
||||||
//virtual bool virt() const override { return false; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual size_t evaluate(const SingleIndex& in) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename U, RangeType TYPE>
|
template <typename U, RangeType TYPE>
|
||||||
class SingleRange : public RangeBase<SingleIndex<U,TYPE> >
|
class SingleRange : public RangeInterface<SingleIndex<U> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename RangeBase<SingleIndex<U,TYPE> >::IndexType IndexType;
|
typedef typename RangeBase<SingleIndex<U> >::IndexType IndexType;
|
||||||
|
|
||||||
static SingleRange<U,TYPE> oType() { return SingleRange<U,TYPE>(); }
|
|
||||||
|
|
||||||
virtual size_t size() const override;
|
virtual size_t size() const override;
|
||||||
|
|
||||||
//U get(size_t pos) const;
|
|
||||||
const U& get(size_t pos) const;
|
const U& get(size_t pos) const;
|
||||||
size_t getMeta(const U& metaPos) const;
|
size_t getMeta(const U& metaPos) const;
|
||||||
|
|
||||||
virtual MultiRangeType type() const override;
|
|
||||||
|
|
||||||
SingleIndex<U,TYPE> begin() const override;
|
virtual SingleIndex<U> begin() const override;
|
||||||
SingleIndex<U,TYPE> end() const override;
|
virtual SingleIndex<U> end() const override;
|
||||||
|
|
||||||
|
friend SingleRangeFactory<U,TYPE>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
SingleRange() = delete;
|
||||||
|
SingleRange(const SingleRange& in) = delete;
|
||||||
|
|
||||||
SingleRange(const std::vector<U>& space);
|
SingleRange(const std::vector<U>& space);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue