Boost logo

Boost Users :

From: Stephen torri (storri_at_[hidden])
Date: 2004-11-08 00:16:14


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()
        << "\"]";
  }
};

The error I get is:

cd /home/storri/src/libreverse/src/infrastructure/
g++ -g -Wall -o graph_test2 graph_test2.cpp
/usr/include/boost/graph/graphviz.hpp: In function `void
   boost::write_graphviz(std::ostream&, const Graph&,
VertexPropertiesWriter,
   EdgePropertiesWriter, GraphPropertiesWriter) [with Graph =
   boost::adjacency_list<boost::setS, boost::setS, boost::directedS,
   boost::property<boost::vertex_index_t, uint32_t,
   boost::property<boost::vertex_name_t, boost::shared_ptr<Component>,
   boost::no_property> >, boost::no_property, boost::no_property,
   boost::listS>, VertexPropertiesWriter = Component_Writer,
   EdgePropertiesWriter = boost::default_writer, GraphPropertiesWriter =
   boost::default_writer]':
/usr/include/boost/graph/graphviz.hpp:292: instantiated from `void
boost::write_graphviz(std::ostream&, const Graph&, VertexWriter) [with
Graph = boost::adjacency_list<boost::setS, boost::setS,
boost::directedS, boost::property<boost::vertex_index_t, uint32_t,
boost::property<boost::vertex_name_t, boost::shared_ptr<Component>,
boost::no_property> >, boost::no_property, boost::no_property,
boost::listS>, VertexWriter = Component_Writer]'
graph_test2.cpp:484: instantiated from here
/usr/include/boost/graph/graphviz.hpp:264: error: no match for call to
`(
   Component_Writer) (std::basic_ostream<char, std::char_traits<char>
>&, void*
   const&)'
graph_test2.cpp:49: error: candidates are: void
   Component_Writer::operator()(std::ostream&, const
   boost::shared_ptr<Component>&) const

Compilation exited abnormally with code 1 at Mon Nov 8 00:15:3

Stephen

-- 
Email: storri_at_[hidden]

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