memgraph/storage/cursor.hpp

35 lines
619 B
C++
Raw Normal View History

2016-01-02 19:20:51 +08:00
#pragma once
#include "transactions/transaction.hpp"
#include "mvcc/version_list.hpp"
#include "storage/model/properties/property.hpp"
#include "storage/vertex.hpp"
2016-01-09 21:43:55 +08:00
template <class Accessor, class It, class Derived>
class Cursor : public Crtp<Derived>
2016-01-02 19:20:51 +08:00
{
public:
2016-01-09 21:43:55 +08:00
Cursor(Accessor&& accessor, It item, tx::Transaction& t)
2016-01-02 19:20:51 +08:00
: accessor(accessor), item(item), t(t)
{
}
Derived& operator++()
{
++item;
2016-01-09 21:43:55 +08:00
return this->derived();
2016-01-02 19:20:51 +08:00
}
Derived& operator++(int)
{
return operator++();
}
protected:
Accessor accessor;
tx::Transaction& t;
It item;
};