memgraph/include/storage/model/edge_list.hpp
Kruno Tomola Fabro ff07babeba Commmit for buda.
2016-08-30 05:29:30 +01:00

35 lines
775 B
C++

#pragma once
#include <vector>
#include "mvcc/version_list.hpp"
#include "storage/edge_record.hpp"
class EdgeList
{
public:
auto begin() { return edges.begin(); }
auto begin() const { return edges.begin(); }
auto cbegin() const { return edges.begin(); }
auto end() { return edges.end(); }
auto end() const { return edges.end(); }
auto cend() const { return edges.end(); }
void add(EdgeRecord *edge) { edges.push_back(edge); }
size_t degree() const { return edges.size(); }
void remove(EdgeRecord *edge)
{
edges.erase(std::remove(edges.begin(), edges.end(), edge), edges.end());
}
void clear() { edges.clear(); }
std::size_t size() { return edges.size(); }
private:
std::vector<EdgeRecord *> edges;
};