fixes regarding last commit
This commit is contained in:
parent
d8ecf51698
commit
c277fbde53
7 changed files with 49 additions and 30 deletions
|
@ -121,10 +121,10 @@ namespace MultiArrayTools
|
|||
}
|
||||
|
||||
template <class Range, typename... Args>
|
||||
auto createRangeE(const Args&... args)
|
||||
auto createRangeE(Args&&... args)
|
||||
-> std::shared_ptr<Range>
|
||||
{
|
||||
typename Range::Factory f(args...);
|
||||
typename Range::FType f(args...);
|
||||
return createExplicit(f);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace MultiArrayTools
|
|||
-> std::shared_ptr<Range>;
|
||||
|
||||
template <class Range, typename... Args>
|
||||
auto createRangeE(const Args&... args)
|
||||
auto createRangeE(Args&&... args)
|
||||
-> std::shared_ptr<Range>;
|
||||
|
||||
template <size_t N, class MArray>
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace MultiArrayTools
|
|||
virtual T* data() override;
|
||||
virtual vector<T>& vdata() { return mCont; }
|
||||
virtual const vector<T>& vdata() const { return mCont; }
|
||||
vector<T>&& vmove() { MAB::mInit = false; return std::move(mCont); }
|
||||
|
||||
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
|
||||
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymousMove() override;
|
||||
|
|
|
@ -439,7 +439,7 @@ namespace MultiArrayTools
|
|||
template <class EC>
|
||||
typename DynamicRange<EC>::MetaType DynamicRange<EC>::get(size_t pos) const
|
||||
{
|
||||
std::vector<char> out(cmeta(nullptr,0));
|
||||
vector<char> out(cmeta(nullptr,0));
|
||||
cmeta(out.data(),pos);
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,8 @@ namespace MultiArrayTools
|
|||
IndexWrapperBase& operator=(const IndexWrapperBase& in) = default;
|
||||
IndexWrapperBase& operator=(IndexWrapperBase&& in) = default;
|
||||
|
||||
using AbstractIW::operator=;
|
||||
|
||||
template <class Expr>
|
||||
ExpressionHolder<Expr> ifor(size_t step, ExpressionHolder<Expr> ex) const;
|
||||
|
||||
|
@ -134,17 +136,17 @@ namespace MultiArrayTools
|
|||
|
||||
virtual IndexType type() const final { return mI->type(); }
|
||||
|
||||
virtual IndexWrapper& operator=(size_t pos) final { (*mI) = pos; return *this; }
|
||||
virtual IndexWrapper& operator++() final { ++(*mI); return *this; }
|
||||
virtual IndexWrapper& operator--() final { --(*mI); return *this; }
|
||||
virtual IndexWrapper& operator=(size_t pos) override final { (*mI) = pos; return *this; }
|
||||
virtual IndexWrapper& operator++() override final { ++(*mI); return *this; }
|
||||
virtual IndexWrapper& operator--() override final { --(*mI); return *this; }
|
||||
|
||||
virtual size_t pos() const final { return mI->pos(); }
|
||||
virtual size_t max() const final { return mI->max(); }
|
||||
virtual size_t pos() const override final { return mI->pos(); }
|
||||
virtual size_t max() const override final { return mI->max(); }
|
||||
|
||||
virtual int pp(std::intptr_t idxPtrNum) final { return mI->pp(idxPtrNum); }
|
||||
virtual int mm(std::intptr_t idxPtrNum) final { return mI->mm(idxPtrNum); }
|
||||
virtual int pp(std::intptr_t idxPtrNum) override final { return mI->pp(idxPtrNum); }
|
||||
virtual int mm(std::intptr_t idxPtrNum) override final { return mI->mm(idxPtrNum); }
|
||||
|
||||
virtual std::string stringMeta() const final { return mI->stringMeta(); }
|
||||
virtual std::string stringMeta() const override final { return mI->stringMeta(); }
|
||||
//virtual DynamicMetaT meta() const final { return DynamicMetaT(mI->meta()); }
|
||||
//virtual const DynamicMetaT* metaPtr() const final { return nullptr; }
|
||||
IndexWrapper& at(const typename Index::MetaType& metaPos) { mI->at(metaPos); return *this; }
|
||||
|
@ -152,24 +154,24 @@ namespace MultiArrayTools
|
|||
|
||||
//virtual bool isMeta(const U& metaPos) const final { return mI->isMeta(); }
|
||||
|
||||
virtual size_t dim() const final { return mI->dim(); }
|
||||
virtual bool last() const final { return mI->last(); }
|
||||
virtual bool first() const final { return mI->first(); }
|
||||
virtual size_t dim() const override final { return mI->dim(); }
|
||||
virtual bool last() const override final { return mI->last(); }
|
||||
virtual bool first() const override final { return mI->first(); }
|
||||
|
||||
virtual std::shared_ptr<RangeBase> range() const final { return mI->range(); }
|
||||
virtual std::shared_ptr<RangeBase> range() const override final { return mI->range(); }
|
||||
|
||||
virtual size_t getStepSize(size_t n) const final { return mI->getStepSize(n); }
|
||||
virtual size_t getStepSizeComp(std::intptr_t j) const final;
|
||||
virtual size_t getStepSize(size_t n) const override final { return mI->getStepSize(n); }
|
||||
virtual size_t getStepSizeComp(std::intptr_t j) const override final;
|
||||
|
||||
virtual std::intptr_t get() const final { return reinterpret_cast<std::intptr_t>(mI.get()); }
|
||||
virtual std::intptr_t ptrNum() const final { return mI->ptrNum(); }
|
||||
virtual std::intptr_t get() const override final { return reinterpret_cast<std::intptr_t>(mI.get()); }
|
||||
virtual std::intptr_t ptrNum() const override final { return mI->ptrNum(); }
|
||||
|
||||
};
|
||||
|
||||
//typedef SingleRange<size_t,SpaceType::DYN> DynamicRange;
|
||||
|
||||
template <class EC>
|
||||
class DynamicIndex : public IndexInterface<DynamicIndex<EC>,std::vector<char>>
|
||||
class DynamicIndex : public IndexInterface<DynamicIndex<EC>,vector<char>>
|
||||
{
|
||||
private:
|
||||
typedef vector<std::pair<std::shared_ptr<IndexW<EC>>,size_t>> IVecT;
|
||||
|
@ -177,8 +179,8 @@ namespace MultiArrayTools
|
|||
IVecT mIVec;
|
||||
|
||||
public:
|
||||
typedef IndexInterface<DynamicIndex<EC>,std::vector<char>> IB;
|
||||
typedef std::vector<char> MetaType;
|
||||
typedef IndexInterface<DynamicIndex<EC>,vector<char>> IB;
|
||||
typedef vector<char> MetaType;
|
||||
typedef DynamicRange<EC> RangeType;
|
||||
typedef DynamicIndex IType;
|
||||
|
||||
|
@ -287,7 +289,8 @@ namespace MultiArrayTools
|
|||
typedef RangeBase RB;
|
||||
typedef DynamicIndex<EC> IndexType;
|
||||
typedef DynamicRange RangeType;
|
||||
typedef std::vector<char> MetaType;
|
||||
typedef vector<char> MetaType;
|
||||
typedef DynamicRangeFactory<EC> FType;
|
||||
|
||||
private:
|
||||
DynamicRange() = default;
|
||||
|
|
|
@ -108,6 +108,7 @@ namespace MultiArrayTools
|
|||
|
||||
GenSingleRangeFactory() = delete;
|
||||
GenSingleRangeFactory(const vector<U>& space);
|
||||
GenSingleRangeFactory(vector<U>&& space);
|
||||
std::shared_ptr<RangeBase> create();
|
||||
};
|
||||
|
||||
|
@ -264,6 +265,7 @@ namespace MultiArrayTools
|
|||
GenSingleRange(const GenSingleRange& in) = delete;
|
||||
|
||||
GenSingleRange(const vector<U>& space);
|
||||
GenSingleRange(vector<U>&& space);
|
||||
|
||||
vector<U> mSpace;
|
||||
//std::map<U,size_t> mMSpace;
|
||||
|
@ -498,6 +500,12 @@ namespace MultiArrayTools
|
|||
mProd = std::shared_ptr<oType>( new GenSingleRange<U,TYPE,S>( space ) );
|
||||
}
|
||||
|
||||
template <typename U, SpaceType TYPE, size_t S>
|
||||
GenSingleRangeFactory<U,TYPE,S>::GenSingleRangeFactory(vector<U>&& space)
|
||||
{
|
||||
mProd = std::shared_ptr<oType>( new GenSingleRange<U,TYPE,S>( space ) );
|
||||
}
|
||||
|
||||
template <typename U, SpaceType TYPE, size_t S>
|
||||
std::shared_ptr<RangeBase> GenSingleRangeFactory<U,TYPE,S>::create()
|
||||
{
|
||||
|
@ -519,6 +527,12 @@ namespace MultiArrayTools
|
|||
//}
|
||||
}
|
||||
|
||||
template <typename U, SpaceType TYPE, size_t S>
|
||||
GenSingleRange<U,TYPE,S>::GenSingleRange(vector<U>&& space) :
|
||||
RangeInterface<GenSingleIndex<U,TYPE,S> >(),
|
||||
mSpace(space), mMSpace(mSpace) {}
|
||||
|
||||
|
||||
template <typename U, SpaceType TYPE, size_t S>
|
||||
const U& GenSingleRange<U,TYPE,S>::get(size_t pos) const
|
||||
{
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace MultiArrayTools
|
|||
typedef ValueIndex<U> IndexType;
|
||||
typedef ValueRange RangeType;
|
||||
typedef U MetaType;
|
||||
typedef ValueRangeFactory<U> FType;
|
||||
|
||||
virtual size_t size() const final;
|
||||
virtual size_t dim() const final;
|
||||
|
@ -111,8 +112,8 @@ namespace MultiArrayTools
|
|||
virtual SpaceType spaceType() const final;
|
||||
virtual DataHeader dataHeader() const final;
|
||||
|
||||
virtual size_t typeNum() const = 0;
|
||||
virtual size_t cmeta(char* target, size_t pos) const = 0;
|
||||
virtual size_t typeNum() const final;
|
||||
virtual size_t cmeta(char* target, size_t pos) const final;
|
||||
virtual std::string stringMeta(size_t pos) const final;
|
||||
virtual vector<char> data() const final;
|
||||
|
||||
|
|
Loading…
Reference in a new issue