Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

UndirEdgeSetWriter Class Template Reference
[Input Output]

#include <lemon/lemon_writer.h>

Inherits CommonSectionWriterBase.

Inheritance diagram for UndirEdgeSetWriter:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<typename _Graph, typename _Traits = DefaultWriterTraits>
class lemon::UndirEdgeSetWriter< _Graph, _Traits >

The lemon format can store multiple undirected edgesets with several maps. The undirected edgeset section's header line is @undiredgeset undiredgeset_id, but the undiredgeset_id may be empty.

The first line of the section contains the names of the maps separated with white spaces. Each next lines describes an undirected edge in the edgeset. The line contains the two connected nodes' id and the mapped values for each undirected map.

The section can handle the directed as a syntactical sugar. Two undirected edge map describes one directed edge map. This two maps are the forward map and the backward map and the names of this map is near the same just with a prefix '+' or '-' character difference.

If the edgeset contains an "id" named map then it will be regarded as id map. This map should contain only unique values and when the writeId() member will be called with an undirected edge it will write it's id. Otherwise if the _forceIdMap constructor parameter is true then the id map will be the id in the graph.

The undirected edgeset writer needs a node id writer to identify which nodes have to be connected. If a NodeSetWriter can write the nodes' id, it will be able to use with this class.


Public Member Functions

template<typename NodeIdWriter>
 UndirEdgeSetWriter (LemonWriter &_writer, const Graph &_graph, const NodeIdWriter &_nodeIdWriter, const std::string &_id=std::string(), bool _forceIdMap=true)
 Constructor.
virtual ~UndirEdgeSetWriter ()
 Destructor.
template<typename Map>
UndirEdgeSetWriterwriteUndirEdgeMap (std::string name, const Map &map)
 Add a new undirected edge map writer command for the writer.
template<typename Writer, typename Map>
UndirEdgeSetWriterwriteUndirEdgeMap (std::string name, const Map &map, const Writer &writer=Writer())
 Add a new undirected map writer command for the writer.
template<typename Map>
UndirEdgeSetWriterwriteEdgeMap (std::string name, const Map &map)
 Add a new directed edge map writer command for the writer.
template<typename Writer, typename Map>
UndirEdgeSetWriterwriteEdgeMap (std::string name, const Map &map, const Writer &writer=Writer())
 Add a new directed map writer command for the writer.
bool isIdWriter () const
 Returns true if the undirected edgeset can write the ids of the edges.
void writeId (std::ostream &os, const UndirEdge &item) const
 Write the id of the given undirected edge.
void writeId (std::ostream &os, const Edge &item) const
 Write the id of the given edge.

Protected Member Functions

virtual std::string header ()
 The header of the section.
virtual void write (std::ostream &os)
 Writer function of the section.


Constructor & Destructor Documentation

UndirEdgeSetWriter LemonWriter _writer,
const Graph &  _graph,
const NodeIdWriter &  _nodeIdWriter,
const std::string _id = std::string(),
bool  _forceIdMap = true
[inline]
 

Constructor for UndirEdgeSetWriter. It creates the UndirEdgeSetWriter and attach it into the given LemonWriter. It will write node ids by the _nodeIdWriter. If the _forceIdMap parameter is true then the writer will write own id map if the user does not give "id" named map.

virtual ~UndirEdgeSetWriter  )  [inline, virtual]
 

Destructor for UndirEdgeSetWriter.


Member Function Documentation

UndirEdgeSetWriter& writeUndirEdgeMap std::string  name,
const Map &  map
[inline]
 

Add a new undirected map writer command for the writer.

UndirEdgeSetWriter& writeUndirEdgeMap std::string  name,
const Map &  map,
const Writer &  writer = Writer()
[inline]
 

Add a new undirected map writer command for the writer.

UndirEdgeSetWriter& writeEdgeMap std::string  name,
const Map &  map
[inline]
 

Add a new directed map writer command for the writer.

UndirEdgeSetWriter& writeEdgeMap std::string  name,
const Map &  map,
const Writer &  writer = Writer()
[inline]
 

Add a new directed map writer command for the writer.

virtual std::string header  )  [inline, protected, virtual]
 

It gives back the header of the section.

Implements LemonWriter::SectionWriter.

virtual void write std::ostream os  )  [inline, protected, virtual]
 

Write the content of the section.

Implements LemonWriter::SectionWriter.

bool isIdWriter  )  const [inline]
 

Returns true if the undirected edgeset can write the ids of the undirected edges. It is possible only if an "id" named map was written or the _forceIdMap constructor parameter was true.

void writeId std::ostream os,
const UndirEdge &  item
const [inline]
 

It writes the id of the given undirected edge. If there was written an "id" named map then it will write the map value belongs to the undirected edge. Otherwise if the forceId parameter was true it will write its id in the graph.

void writeId std::ostream os,
const Edge &  item
const [inline]
 

It writes the id of the given edge. If there was written an "id" named map then it will write the map value belongs to the edge. Otherwise if the forceId parameter was true it will write its id in the graph. If the edge is forward map then its prefix character is '+' elsewhere '-'.


The documentation for this class was generated from the following file:
Generated on Sat Aug 27 14:15:55 2005 for LEMON by  doxygen 1.4.4