cnorxz/src/range_base.h

59 lines
780 B
C
Raw Normal View History

2017-02-16 11:20:40 +01:00
// -*- C++ -*-
#ifndef __range_base_h__
#define __range_base_h__
#include <cstdlib>
#include <vector>
#include <memory>
2017-02-16 11:20:40 +01:00
#include "base_def.h"
namespace MultiArrayTools
{
enum class RangeType
{
NIL = 0,
ANY = 1,
SPACE = 2,
MOMENTUM = 3,
LORENTZ = 4,
SPIN = 5,
2017-03-14 23:00:41 +01:00
ENSEMBLE = 6,
VALUE_ERROR = 7,
DISTANCE = 8
2017-02-16 11:20:40 +01:00
};
class RangeBase
2017-02-16 11:20:40 +01:00
{
public:
virtual ~RangeBase() = default;
virtual size_t size() const = 0;
virtual size_t dim() const = 0;
2017-02-16 11:20:40 +01:00
virtual std::shared_ptr<IndexBase> index() const = 0;
2017-02-16 11:20:40 +01:00
2017-06-01 13:19:27 +02:00
protected:
2017-05-24 19:01:02 +02:00
};
2017-02-16 11:20:40 +01:00
template <class Index>
class RangeInterface : public RangeBase
2017-02-16 11:20:40 +01:00
{
public:
2017-05-31 16:44:28 +02:00
typedef Index IndexType;
2017-06-01 13:19:27 +02:00
virtual Index begin() = 0;
virtual Index end() = 0;
2017-02-16 11:20:40 +01:00
};
}
#include "range_base.cc"
#endif