cnorxz/src/include/ranges/nrange.h

97 lines
2.6 KiB
C
Raw Normal View History

#ifdef include_range_type
include_range_type(NUL,-2)
#else
#ifdef __cxz_ranges_header__
// assert, that this is only used within range_types/header.h
#ifndef __cxz_range_type_null_def__
#define __cxz_range_type_null_def__
2021-07-28 20:29:56 +02:00
namespace CNORXZ
{
typedef GenSingleIndex<size_t,SpaceType::NUL,0> NullIndex;
std::shared_ptr<GenSingleRange<size_t,SpaceType::NUL,0> > nullr();
2018-07-20 19:13:42 +02:00
std::shared_ptr<NullIndex> nulli();
template <>
class GenSingleRangeFactory<size_t,SpaceType::NUL,0> : public RangeFactoryBase
{
public:
typedef GenSingleRange<size_t,SpaceType::NUL,0> oType;
GenSingleRangeFactory();
std::shared_ptr<RangeBase> create();
2018-07-20 19:13:42 +02:00
friend std::shared_ptr<oType> nullr();
2018-07-20 19:13:42 +02:00
private:
static std::shared_ptr<oType> mRInstance;
};
template <>
class GenSingleRange<size_t,SpaceType::NUL,0> : public RangeInterface<NullIndex>
{
public:
typedef RangeBase RB;
typedef typename RangeInterface<GenSingleIndex<size_t,SpaceType::NUL,0> >::IndexType IndexType;
typedef GenSingleRange<size_t,SpaceType::NUL,0> RangeType;
typedef size_t MetaType;
typedef GenSingleRangeFactory<size_t,SpaceType::NUL,0> FType;
virtual size_t size() const final;
virtual size_t dim() const final;
virtual vector<size_t> typeNum() const final;
2019-03-14 14:20:38 +01:00
virtual size_t cmeta(char* target, size_t pos) const final;
virtual size_t cmetaSize() const final;
virtual std::string stringMeta(size_t pos) const final;
2019-02-13 21:59:13 +01:00
virtual vector<char> data() const final;
2018-07-28 15:27:11 +02:00
virtual SpaceType spaceType() const final;
2018-11-07 10:58:07 +01:00
virtual DataHeader dataHeader() const final;
size_t get(size_t pos) const;
size_t getMeta(size_t metapos) const;
virtual IndexType begin() const final;
virtual IndexType end() const final;
//virtual std::shared_ptr<VIWB> index() const final;
friend GenSingleRangeFactory<size_t,SpaceType::NUL,0>;
static constexpr bool defaultable = true;
static constexpr size_t ISSTATIC = 1;
static constexpr size_t SIZE = 1;
static constexpr bool HASMETACONT = false;
static GenSingleRangeFactory<size_t,SpaceType::NUL,0> factory()
{ return GenSingleRangeFactory<size_t,SpaceType::NUL,0>(); }
protected:
GenSingleRange() = default;
GenSingleRange(const GenSingleRange& in) = delete;
//GenSingleRange(size_t spinNum);
};
typedef GenSingleRange<size_t,SpaceType::NUL,0> NullRange;
typedef GenSingleRangeFactory<size_t,SpaceType::NUL,0> NullRF;
std::shared_ptr<NullRF> mkNUL(const char* dp, size_t size);
}
#endif // #ifndef __cxz_range_type_null_def__
#endif // #ifdef __cxz_ranges_header__
#endif // #ifdef include_range_type