|
Boost Users : |
From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2004-08-31 13:13:49
I've apparently succeeded in switching from external to internal
properites in my application.
However, I've done things in an OOP way, and would like to know if
somebody can point out potential trouble.
I've a class, called Graph, that inherits from the boost::graph object.
The start of its definition is:
class Graph : public GraphT
{
public:
Graph();
// Graph Data accessor methods
typedef boost::property_map<GraphT, vertex_Datum_t>::type VertexData;
typedef boost::property_map<GraphT, edge_Datum_t>::type EdgeData;
const VertexData& getVertexData(void) const {return vertexData_;}
...
private:
VertexData vertexData_;
};
Note the typedef of VertexData. I initialize vertexData_ in the Graph
constructor like this:
vertexData_ = boost::get(vertex_Datum, *this);
I've numerous methods like this in Graph:
Vertex
DataGraph::add_vertex(LayoutVertex *pLayoutVertex)
{
Vertex vertex = boost::add_vertex(*this);
boost::put(vertexData_,vertex,Vertex_Datum(pLayoutVertex));
return vertex;
}
I guess my biggest concern is initializing vertexData_ once, before the
graph has any data, and keeping it around though the life of the graph.
Is this safe?
Also, I expect clients of this class to be able to use the operator[]
method via getVertexData(). Will this work?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net