string meta via index

This commit is contained in:
Christian Zimmermann 2018-07-22 16:16:24 +02:00
parent fc40f83dd8
commit f14edd17e4
4 changed files with 28 additions and 6 deletions

View file

@ -80,7 +80,8 @@ namespace MultiArrayTools
int pp(std::intptr_t idxPtrNum);
int mm(std::intptr_t idxPtrNum);
std::string stringMeta() const;
MetaType meta() const;
ContainerIndex& at(const MetaType& metaPos);
@ -334,6 +335,12 @@ namespace MultiArrayTools
return tmp;
}
template <typename T, class... Indices>
std::string ContainerIndex<T,Indices...>::stringMeta() const
{
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->stringMeta(IB::mPos);
}
template <typename T, class... Indices>
typename ContainerIndex<T,Indices...>::MetaType ContainerIndex<T,Indices...>::meta() const
{

View file

@ -59,6 +59,7 @@ namespace MultiArrayTools
std::string id() const { return THIS().id(); }
std::string stringMeta() const { return THIS().stringMeta(); }
MetaType meta() const { return THIS().meta(); }
MetaType metaPtr() const { return THIS().metaPtr(); }
I& at(const MetaType& meta) { return THIS().at(meta); }

View file

@ -91,7 +91,8 @@ namespace MultiArrayTools
int pp(std::intptr_t idxPtrNum);
int mm(std::intptr_t idxPtrNum);
MetaType meta();
std::string stringMeta() const;
MetaType meta() const;
MultiIndex& at(const MetaType& metaPos);
size_t dim();
@ -344,7 +345,13 @@ namespace MultiArrayTools
}
template <class... Indices>
typename MultiIndex<Indices...>::MetaType MultiIndex<Indices...>::meta()
std::string MultiIndex<Indices...>::stringMeta() const
{
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->stringMeta(IB::mPos);
}
template <class... Indices>
typename MultiIndex<Indices...>::MetaType MultiIndex<Indices...>::meta() const
{
MetaType metaTuple;
RPackNum<sizeof...(Indices)-1>::getMetaPos(metaTuple, mIPack);

View file

@ -48,8 +48,9 @@ namespace MultiArrayTools
int pp(std::intptr_t idxPtrNum);
int mm(std::intptr_t idxPtrNum);
U meta();
std::string stringMeta() const;
U meta() const;
const U* metaPtr() const;
SingleIndex& at(const U& metaPos);
@ -223,7 +224,13 @@ namespace MultiArrayTools
}
template <typename U, SpaceType TYPE>
U SingleIndex<U,TYPE>::meta()
std::string SingleIndex<U,TYPE>::stringMeta() const
{
return std::dynamic_pointer_cast<SingleRange<U,TYPE> const>( IB::mRangePtr )->stringMeta(IB::mPos);
}
template <typename U, SpaceType TYPE>
U SingleIndex<U,TYPE>::meta() const
{
return MetaPtrHandle<SingleIndex<U,TYPE>::RangeType::HASMETACONT>::getMeta
( mMetaPtr, IB::mPos,