
On Nov 8, 2004, at 12:16 AM, Stephen torri wrote:
I have the following graph:
typedef property< vertex_index_t, uint32_t, property< vertex_name_t, boost::shared_ptr<Component> > > VertexProperty;
typedef adjacency_list<setS, // OutEdgeList setS, // VertexList directedS, // Directed VertexProperty> // VertexProperties Graph_Type;
When I looked at the documentation I did not see an example which used a boost::shared_ptr to store information at the vertex. Here is my attempt at writing a PropertyWriter. I cannot figure out how to write the 2nd function argument type:
class Component_Writer { public: void operator()(std::ostream& out, const boost::shared_ptr<Component> obj) const { out << "[label=\"" << obj_ptr->get_Name() << "\n" << obj_ptr->get_ID() << "\"]"; } };
A property writer is passed the output stream and the descriptor, so you want to write Component_Writer like so: class Component_Writer { public: typedef boost::graph_traits<Graph_Type>::vertex_descriptor Vertex_Type; Component_Writer(const Graph_Type& g) : g(g) {} void operator()(std::ostream& out, Vertex_Type v) { boost::shared_ptr<Component> obj_ptr = get(vertex_name, g, v); // code from before... } }; Doug