[Lemon-user] question about write data to lgf file

ZHANG Long zhangloong at gmail.com
Wed Jun 1 05:46:53 CEST 2011


Hi
I'm new to LEMON. It's great that i can assign custom classes to map 
type, The following code works fine.

class vessel
{
public:
     double Vol,Temp;
     void set_para(double nVol, double nTemp);
};
void vessel::set_para(double nVol, double nTemp)
{
     Vol=nVol;
     Temp=nTemp;
}

int main()
{
     ListDigraph g;
     ListDigraph::Node u = g.addNode();
     ListDigraph::Node v = g.addNode();
     ListDigraph::Arc a = g.addArc(u, v);

     ListDigraph::NodeMap<string> name(g);
     ListDigraph::NodeMap<vessel> vessel_property(g);

     name[u] = "Tank";
     name[v] = "Filter";

     vessel_property[u].set_para(0.5, 300);
     vessel_property[v].set_para(0.6, 200);

     cout<<"The temperature of vessel "<<name[u]<<" is 
"<<vessel_property[u].Temp<<endl;

     return 0;
}

Then I want to write the graph to a lgf file:

     digraphWriter(g, "out.lgf")
         .nodeMap("Name", name)
         .run();

The map "name" can be written to file in this way, but how to write the 
" vessel_property" map? I want to output and read it's "Vol", "Temp" etc.

Thank you very much.




More information about the Lemon-user mailing list