00001
00002
00003 #ifndef VGS_GraphLoader_H
00004 #define VGS_GraphLoader_H
00005
00006 #include "GraphTypes.h"
00007 #include "GraphData.h"
00008
00009 namespace VGServer {
00010
00015 class GraphLoader : private GraphData
00016 {
00017 private:
00018
00019
00022 vertexid_t vertex_minnum;
00023
00026 unsigned int vertex_aidx;
00027
00029 unsigned int vertex_aidxnext;
00030
00032 unsigned int vertex_lastid;
00033
00035 void finishVertexAttrSequence();
00036
00037
00039
00041 vertexid_t edge_minsrc;
00042
00044 vertexid_t edge_mintgt;
00045
00047 unsigned int edge_eidx;
00048
00051 unsigned int edge_aidx;
00052
00054 unsigned int edge_aidxnext;
00055
00057 unsigned int edge_lastid;
00058
00060 void finishEdgeAttrSequence();
00061
00062 public:
00064 explicit GraphLoader(const class GraphProperties &gp);
00065
00068 class GraphData& finish();
00069
00071 void terminate();
00072
00081 void reserve(unsigned int vertexnum, unsigned int edgenum,
00082 unsigned int vertexattrsize, unsigned int edgeattrsize);
00083
00086 void addVertex(vertexid_t vid);
00087
00091 void setVertexAttr(vertexid_t vid, unsigned int attrid, const class AnyType &value);
00092
00096 void addEdge(vertexid_t src, vertexid_t tgt);
00097
00101 void setEdgeAttr(vertexid_t src, vertexid_t tgt,
00102 unsigned int attrid, const class AnyType &value);
00103 };
00104
00107 class OrderException : std::exception
00108 {
00109 };
00110
00113 class DataLoadedException : std::exception
00114 {
00115 };
00116
00117 }
00118
00119 #endif // VGS_GraphLoader_H