void XC::Graph::copy(const Graph &other) { const size_t numVertex= other.getNumVertex(); if(numVertex>0) { inic(numVertex); Graph &other_no_const= const_cast<Graph &>(other); VertexIter &otherVertices= other_no_const.getVertices(); Vertex *vertexPtr= nullptr; // loop through other creating vertices if tag not the same in this while((vertexPtr = otherVertices()) != nullptr) { const int vertexTag= vertexPtr->getTag(); const int vertexRef= vertexPtr->getRef(); Vertex newVertex(vertexTag, vertexRef); this->addVertex(newVertex, false); } // loop through other adding all the edges that exist in other VertexIter &otherVertices2 = other_no_const.getVertices(); while((vertexPtr = otherVertices2()) != nullptr) { int vertexTag = vertexPtr->getTag(); const std::set<int> &adjacency= vertexPtr->getAdjacency(); for(std::set<int>::const_iterator i=adjacency.begin(); i!=adjacency.end(); i++) { if(this->addEdge(vertexTag, *i) < 0) { std::cerr << "Graph::" << __FUNCTION__ << "; could not add an edge!\n"; return; } } } } else { inic(32); numEdge= 0; nextFreeTag= START_VERTEX_NUM; } theVertexIter= VertexIter(&myVertices); }
VboMesh::VertexIter VboMesh::mapVertexBuffer() { return VertexIter( *this ); }