ContainerRange typedef: remove template arg T + remove MultiRange Factory constructor for ContainerRange

This commit is contained in:
Christian Zimmermann 2021-05-28 19:48:27 +02:00
parent 34e69cd805
commit 1d882d55c4
11 changed files with 24 additions and 29 deletions

View file

@ -79,7 +79,7 @@ namespace MultiArrayTools
{ {
public: public:
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB; typedef MultiArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;
typedef MultiArray<T,SRanges...> MAType; typedef MultiArray<T,SRanges...> MAType;

View file

@ -30,7 +30,7 @@ namespace MultiArrayTools
{ {
public: public:
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB; typedef MultiArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;

View file

@ -54,16 +54,16 @@ namespace MultiArrayTools
template <typename T, class... SRanges> template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(const std::shared_ptr<SRanges>&... ranges) MultiArrayBase<T,SRanges...>::MultiArrayBase(const std::shared_ptr<SRanges>&... ranges)
{ {
ContainerRangeFactory<T,SRanges...> crf(ranges...); ContainerRangeFactory<SRanges...> crf(ranges...);
mRange = std::dynamic_pointer_cast<ContainerRange<T,SRanges...> >( crf.create() ); mRange = std::dynamic_pointer_cast<ContainerRange<SRanges...> >( crf.create() );
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) ); mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
} }
template <typename T, class... SRanges> template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(const typename CRange::Space& space) MultiArrayBase<T,SRanges...>::MultiArrayBase(const typename CRange::Space& space)
{ {
ContainerRangeFactory<T,SRanges...> crf(space); ContainerRangeFactory<SRanges...> crf(space);
mRange = std::dynamic_pointer_cast<ContainerRange<T,SRanges...> >( crf.create() ); mRange = std::dynamic_pointer_cast<ContainerRange<SRanges...> >( crf.create() );
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) ); mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
} }

View file

@ -56,7 +56,7 @@ namespace MultiArrayTools
public: public:
typedef T value_type; typedef T value_type;
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;
protected: protected:
@ -125,7 +125,7 @@ namespace MultiArrayTools
{ {
public: public:
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB; typedef MultiArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;

View file

@ -410,7 +410,7 @@ namespace MultiArrayTools
typedef T value_type; typedef T value_type;
typedef OperationBase<T,ConstOperationRoot<T,Ranges...> > OT; typedef OperationBase<T,ConstOperationRoot<T,Ranges...> > OT;
typedef ContainerRange<T,Ranges...> CRange; typedef ContainerRange<Ranges...> CRange;
typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType;
static constexpr size_t SIZE = 1; static constexpr size_t SIZE = 1;
@ -534,7 +534,7 @@ namespace MultiArrayTools
typedef T value_type; typedef T value_type;
typedef OperationBase<T,OperationRoot<T,Ranges...> > OT; typedef OperationBase<T,OperationRoot<T,Ranges...> > OT;
typedef ContainerRange<T,Ranges...> CRange; typedef ContainerRange<Ranges...> CRange;
typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType;
static constexpr size_t SIZE = 1; static constexpr size_t SIZE = 1;
@ -629,7 +629,7 @@ namespace MultiArrayTools
typedef T value_type; typedef T value_type;
typedef OperationBase<T,ParallelOperationRoot<T,Ranges...> > OT; typedef OperationBase<T,ParallelOperationRoot<T,Ranges...> > OT;
typedef ContainerRange<T,Ranges...> CRange; typedef ContainerRange<Ranges...> CRange;
typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType; typedef ConstContainerIndex<T,typename Ranges::IndexType...> IndexType;
static constexpr size_t SIZE = 1; static constexpr size_t SIZE = 1;
@ -714,7 +714,7 @@ namespace MultiArrayTools
public: public:
typedef T value_type; typedef T value_type;
typedef OperationBase<T,OperationValue<T> > OT; typedef OperationBase<T,OperationValue<T> > OT;
typedef ContainerRange<T,NullRange> CRange; typedef ContainerRange<NullRange> CRange;
typedef ConstContainerIndex<T,NullIndex> IndexType; typedef ConstContainerIndex<T,NullIndex> IndexType;
static constexpr size_t SIZE = 0; static constexpr size_t SIZE = 0;

View file

@ -24,7 +24,7 @@ namespace MultiArrayTools
std::tuple<typename Indices::MetaType...> > IB; std::tuple<typename Indices::MetaType...> > IB;
typedef std::tuple<typename Indices::MetaType...> MetaType; typedef std::tuple<typename Indices::MetaType...> MetaType;
typedef std::tuple<std::shared_ptr<Indices>...> IndexPack; typedef std::tuple<std::shared_ptr<Indices>...> IndexPack;
typedef ContainerRange<T,typename Indices::RangeType...> RangeType; typedef ContainerRange<typename Indices::RangeType...> RangeType;
static constexpr IndexType sType() { return IndexType::CONT; } static constexpr IndexType sType() { return IndexType::CONT; }
static constexpr size_t sDim() { return sizeof...(Indices); } static constexpr size_t sDim() { return sizeof...(Indices); }

View file

@ -140,8 +140,8 @@ namespace MultiArrayTools
MultiRangeFactory(const std::shared_ptr<Ranges>&... rs); MultiRangeFactory(const std::shared_ptr<Ranges>&... rs);
MultiRangeFactory(const typename MultiRange<Ranges...>::Space& space); MultiRangeFactory(const typename MultiRange<Ranges...>::Space& space);
template <typename T> //template <typename T>
MultiRangeFactory(const std::shared_ptr<ContainerRange<T,Ranges...> >& cr); //MultiRangeFactory(const std::shared_ptr<ContainerRange<Ranges...> >& cr);
virtual std::shared_ptr<RangeBase> create() override; virtual std::shared_ptr<RangeBase> create() override;
@ -504,12 +504,14 @@ namespace MultiArrayTools
mProd = std::shared_ptr< MultiRange<Ranges...> >( new MultiRange<Ranges...>( st ) ); mProd = std::shared_ptr< MultiRange<Ranges...> >( new MultiRange<Ranges...>( st ) );
} }
/*
template <class... Ranges> template <class... Ranges>
template <typename T> template <typename T>
MultiRangeFactory<Ranges...>::MultiRangeFactory(const std::shared_ptr<ContainerRange<T,Ranges...> >& cr) MultiRangeFactory<Ranges...>::MultiRangeFactory(const std::shared_ptr<ContainerRange<Ranges...> >& cr)
{ {
mProd = std::shared_ptr< MultiRange<Ranges...> >( new MultiRange<Ranges...>( cr->space() ) ); mProd = std::shared_ptr< MultiRange<Ranges...> >( new MultiRange<Ranges...>( cr->space() ) );
} }
*/
template <class... Ranges> template <class... Ranges>
std::shared_ptr<RangeBase> MultiRangeFactory<Ranges...>::create() std::shared_ptr<RangeBase> MultiRangeFactory<Ranges...>::create()

View file

@ -81,15 +81,11 @@ namespace MultiArrayTools
class MultiIndex; class MultiIndex;
// container_range.h // container_range.h
//template <typename T, class... Ranges> template <class... Ranges>
//class ContainerRangeFactory;
template <typename T, class... Ranges>
using ContainerRangeFactory = MultiRangeFactory<Ranges...>; using ContainerRangeFactory = MultiRangeFactory<Ranges...>;
// container_range.h // container_range.h
//template <typename T, class... Ranges> template <class... Ranges>
//class ContainerRange;
template <typename T, class... Ranges>
using ContainerRange = MultiRange<Ranges...>; using ContainerRange = MultiRange<Ranges...>;
// container_range.h // container_range.h
@ -99,9 +95,6 @@ namespace MultiArrayTools
// anonymous_range.h // anonymous_range.h
class AnonymousRangeFactory; class AnonymousRangeFactory;
// anonymous_range.h
//class AnonymousRange;
// dynamic_range.h // dynamic_range.h
class IndexWrapperBase; class IndexWrapperBase;

View file

@ -12,7 +12,7 @@ namespace MultiArrayTools
{ {
public: public:
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB; typedef MultiArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType;
@ -55,7 +55,7 @@ namespace MultiArrayTools
{ {
public: public:
typedef ContainerRange<T,SRanges...> CRange; typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB; typedef MultiArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType; typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType;

View file

@ -50,7 +50,7 @@ namespace {
typedef MultiRangeFactory<SRange,M3Range,SRange> MasterRF; typedef MultiRangeFactory<SRange,M3Range,SRange> MasterRF;
typedef MasterRF::oType MasterRange; typedef MasterRF::oType MasterRange;
typedef ContainerRangeFactory<double,M3Range,SRange> CRF; typedef ContainerRangeFactory<M3Range,SRange> CRF;
typedef CRF::oType CRange; typedef CRF::oType CRange;
typedef ConstContainerIndex<double,M3Range::IndexType,SRange::IndexType> CIndex; typedef ConstContainerIndex<double,M3Range::IndexType,SRange::IndexType> CIndex;

View file

@ -88,7 +88,7 @@ namespace {
typedef MultiRangeFactory<SRange,M3Range,SRange> MasterRF; typedef MultiRangeFactory<SRange,M3Range,SRange> MasterRF;
typedef MasterRF::oType MasterRange; typedef MasterRF::oType MasterRange;
typedef ContainerRangeFactory<double,M3Range,SRange> CRF; typedef ContainerRangeFactory<M3Range,SRange> CRF;
typedef CRF::oType CRange; typedef CRF::oType CRange;
typedef ConstContainerIndex<double,M3Range::IndexType,SRange::IndexType> CIndex; typedef ConstContainerIndex<double,M3Range::IndexType,SRange::IndexType> CIndex;