GraphConnection.h

Go to the documentation of this file.
00001 // $Id: GraphConnection.h 127 2006-05-13 15:30:07Z bingmann $
00002 
00003 #ifndef VGS_GraphConnection_H
00004 #define VGS_GraphConnection_H
00005 
00006 #include "GraphContainer.h"
00007 #include "ChangeTimeline.h"
00008 
00009 namespace VGServer {
00010 
00017 class GraphConnection
00018 {
00019 private:
00020     
00021     class GraphContainer        &graph;
00022 
00023     class ChangeTimeline        changes;
00024 
00025 public:
00027     GraphConnection(GraphContainer &graph);
00028 
00029     virtual ~GraphConnection();
00030 
00031     // *** Methods provides to the application:
00032 
00033     // ** transaction methods to clear or commit the changes
00034 
00036     void        rollback();
00037 
00039     void        commit();
00040     
00041     // ** local changes operating on the ChangeTimeline and may be committed to
00042     // ** the global graph
00043 
00045     inline bool addVertex(vertexid_t id)
00046     { return changes.addVertex(id); }
00047 
00049     inline bool setVertexAttr(vertexid_t id, unsigned int attrid, const AnyType &value)
00050     { return changes.setVertexAttr(id, attrid, value); }
00051     
00053     inline bool delVertex(vertexid_t id)
00054     { return changes.delVertex(id); }
00055     
00057     inline bool addEdge(vertexid_t src, vertexid_t tgt)
00058     { return changes.addEdge(src, tgt); }
00059     
00061     inline bool setEdgeAttr(vertexid_t src, vertexid_t tgt, unsigned int attrid, const AnyType &value)
00062     { return changes.setEdgeAttr(src, tgt, attrid, value); }
00063     
00065     inline bool delEdge(vertexid_t src, vertexid_t tgt)
00066     { return changes.delEdge(src, tgt); }
00067 
00070     inline unsigned int advanceTimeFrame()
00071     { return changes.advanceTimeFrame(); }
00072 
00073     // *** methods to query the local graph snapshot
00074 
00076     inline class VertexRef getVertex(vertexid_t id) const
00077     { return graph.getVertex(id, changes.getChangelistEnd()); }
00078 
00080     inline class EdgeRef getEdge(vertexid_t src, vertexid_t tgt) const
00081     { return graph.getEdge(src, tgt, changes.getChangelistEnd()); }
00082 
00084     typedef std::vector<class EdgeRef>  edgereflist_t;
00085 
00087     inline edgereflist_t getEdgeList(vertexid_t id) const
00088     { return graph.getEdgeList(id, changes.getChangelistEnd()); }
00089 
00090     // *** Methods coined for binary transfer to the client
00091 
00092     // *** create facade class for the client
00093     class GraphClientFace getClientFace();
00094 
00097     void        getGraphProperties(class ByteBuffer &dest) const;
00098 
00102     void        getArea(coord_t x1, coord_t y1, coord_t x2, coord_t y2,
00103                         const QueryLimits *ql,
00104                         const char* filter, const char* vertexattrsel, const char* edgeattrsel,
00105                         class ByteBuffer &dest) const;
00106 
00110     void        getNearestNeighbor(coord_t x1, coord_t y1, coord_t x2, coord_t y2,
00111                                    coord_t selx, coord_t sely, const QueryLimits *ql,
00112                                    const char* filter, const char* vertexattrsel, const char* edgeattrsel,
00113                                    class ByteBuffer &dest) const;
00114 };
00115 
00116 } // namespace VGServer
00117 
00118 #endif // VGS_GraphConnection_H

Generated on Wed Sep 27 14:34:00 2006 for VGServer by  doxygen 1.4.7