im com (dynamic meta)
This commit is contained in:
parent
a1a6b02bb5
commit
7003d68097
4 changed files with 27 additions and 4 deletions
|
@ -439,6 +439,13 @@ namespace MultiArrayTools
|
||||||
template <class EC>
|
template <class EC>
|
||||||
typename DynamicRange<EC>::MetaType DynamicRange<EC>::get(size_t pos) const
|
typename DynamicRange<EC>::MetaType DynamicRange<EC>::get(size_t pos) const
|
||||||
{
|
{
|
||||||
|
for(size_t i = mOrig.size(); i != 0; --i) {
|
||||||
|
auto& x = mOrig[i-1];
|
||||||
|
const size_t redpos = pos % x->size();
|
||||||
|
out = out + x->stringMeta(redpos);
|
||||||
|
pos -= redpos;
|
||||||
|
pos /= x->size();
|
||||||
|
}
|
||||||
return MetaType(); // !!!
|
return MetaType(); // !!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef IndexInterface<DynamicIndex<EC>,DynamicMetaT> IB;
|
typedef IndexInterface<DynamicIndex<EC>,DynamicMetaT> IB;
|
||||||
typedef DynamicMetaT MetaType;
|
typedef std::vector<char> MetaType;
|
||||||
typedef DynamicRange<EC> RangeType;
|
typedef DynamicRange<EC> RangeType;
|
||||||
typedef DynamicIndex IType;
|
typedef DynamicIndex IType;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ namespace MultiArrayTools
|
||||||
typedef RangeBase RB;
|
typedef RangeBase RB;
|
||||||
typedef DynamicIndex<EC> IndexType;
|
typedef DynamicIndex<EC> IndexType;
|
||||||
typedef DynamicRange RangeType;
|
typedef DynamicRange RangeType;
|
||||||
typedef DynamicMetaT MetaType;
|
typedef std::vector<char> MetaType;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DynamicRange() = default;
|
DynamicRange() = default;
|
||||||
|
|
|
@ -79,8 +79,10 @@ namespace MultiArrayTools
|
||||||
bool operator!=(const RangeBase& in) const;
|
bool operator!=(const RangeBase& in) const;
|
||||||
|
|
||||||
std::intptr_t id() const;
|
std::intptr_t id() const;
|
||||||
|
|
||||||
|
virtual size_t typeNum() const = 0;
|
||||||
virtual std::string stringMeta(size_t pos) const = 0;
|
virtual std::string stringMeta(size_t pos) const = 0;
|
||||||
|
virtual const char* cmeta(size_t pos) const = 0;
|
||||||
virtual vector<char> data() const = 0; // usefull when writing to files, etc...
|
virtual vector<char> data() const = 0; // usefull when writing to files, etc...
|
||||||
|
|
||||||
virtual SpaceType spaceType() const = 0;
|
virtual SpaceType spaceType() const = 0;
|
||||||
|
|
|
@ -230,9 +230,11 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
virtual SpaceType spaceType() const final;
|
virtual SpaceType spaceType() const final;
|
||||||
virtual DataHeader dataHeader() const final;
|
virtual DataHeader dataHeader() const final;
|
||||||
|
|
||||||
|
virtual size_t typeNum() const final;
|
||||||
virtual std::string stringMeta(size_t pos) const final;
|
virtual std::string stringMeta(size_t pos) const final;
|
||||||
virtual vector<char> data() const final;
|
virtual vector<char> data() const final;
|
||||||
|
virtual const char* cmeta() const final;
|
||||||
|
|
||||||
bool isMeta(const U& metaPos) const;
|
bool isMeta(const U& metaPos) const;
|
||||||
|
|
||||||
|
@ -369,6 +371,12 @@ namespace MultiArrayTools
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename U, SpaceType TYPE, size_t S>
|
||||||
|
size_t GenSingleIndex<U,TYPE,S>::typeNum() const
|
||||||
|
{
|
||||||
|
return NumTypeMap<U>::num;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename U, SpaceType TYPE, size_t S>
|
template <typename U, SpaceType TYPE, size_t S>
|
||||||
std::string GenSingleIndex<U,TYPE,S>::stringMeta() const
|
std::string GenSingleIndex<U,TYPE,S>::stringMeta() const
|
||||||
{
|
{
|
||||||
|
@ -382,6 +390,12 @@ namespace MultiArrayTools
|
||||||
( mMetaPtr, IB::mPos, mExplicitRangePtr );
|
( mMetaPtr, IB::mPos, mExplicitRangePtr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename U, SpaceType TYPE, size_t S>
|
||||||
|
const char* GenSingleIndex<U,TYPE,S>::cmeta() const
|
||||||
|
{
|
||||||
|
return reinterpret_cast<const char*>(mSpace.data());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename U, SpaceType TYPE, size_t S>
|
template <typename U, SpaceType TYPE, size_t S>
|
||||||
const U* GenSingleIndex<U,TYPE,S>::metaPtr() const
|
const U* GenSingleIndex<U,TYPE,S>::metaPtr() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue