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::type VertexData;
typedef boost::property_map::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?