00001
00002
00003 #include "GraphConnection.h"
00004 #include "GraphContainer.h"
00005 #include "GraphClientFace.h"
00006 #include "ByteOutBuffer.h"
00007
00008 namespace VGServer {
00009
00010 GraphConnection::GraphConnection(GraphContainer &_graph)
00011 : graph(_graph), changes(graph)
00012 {
00013 }
00014
00015 GraphConnection::~GraphConnection()
00016 {
00017 }
00018
00019 class GraphClientFace GraphConnection::getClientFace()
00020 { return GraphClientFace(*this); }
00021
00022 void GraphConnection::rollback()
00023 {
00024 changes.clear();
00025 }
00026
00027 void GraphConnection::commit()
00028 {
00029 graph.applyChangelist(changes.getChangelistEnd());
00030 changes.clear();
00031 }
00032
00033 void GraphConnection::getGraphProperties(class ByteBuffer &dest) const
00034 {
00035 graph.getGraphProperties(dest);
00036 }
00037
00038 void
00039 GraphConnection::getArea(coord_t x1, coord_t y1, coord_t x2, coord_t y2,
00040 const QueryLimits *ql,
00041 const char* filter, const char* vertexattrsel, const char* edgeattrsel,
00042 class ByteBuffer &dest) const
00043 {
00044 graph.getArea(x1, y1, x2, y2, ql, filter, vertexattrsel, edgeattrsel, changes, dest);
00045 }
00046
00047 void
00048 GraphConnection::getNearestNeighbor(coord_t x1, coord_t y1, coord_t x2, coord_t y2,
00049 coord_t selx, coord_t sely, const QueryLimits *ql,
00050 const char* filter, const char* vertexattrsel, const char* edgeattrsel,
00051 class ByteBuffer &dest) const
00052 {
00053 graph.getNearestNeighbor(x1, y1, x2, y2, selx, sely, ql, filter, vertexattrsel, edgeattrsel, changes.getChangelistStart(), dest);
00054 }
00055
00056 }