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

NodeSetWriter Class Template Reference
[Input Output]

#include <lemon/lemon_writer.h>

Inherits CommonSectionWriterBase.

Inheritance diagram for NodeSetWriter:

Inheritance graph
[legend]
List of all members.

Detailed Description

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

The lemon format can store multiple graph nodesets with several maps. The nodeset section's header line is @nodeset nodeset_id, but the nodeset_id may be empty.

The first line of the section contains the names of the maps separated with white spaces. Each next lines describes a node in the nodeset, and contains the mapped values for each map.

If the nodeset 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 a node 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.


Public Member Functions

 NodeSetWriter (LemonWriter &_writer, const Graph &_graph, const std::string &_id=std::string(), bool _forceIdMap=true)
 Constructor.
virtual ~NodeSetWriter ()
 Destructor.
template<typename Map>
NodeSetWriterwriteNodeMap (std::string name, const Map &map)
 Add a new node map writer command for the writer.
template<typename Writer, typename Map>
NodeSetWriterwriteNodeMap (std::string name, const Map &map, const Writer &writer=Writer())
 Add a new node map writer command for the writer.
bool isIdWriter () const
 Returns true if the nodeset can write the ids of the nodes.
void writeId (std::ostream &os, const Node &item) const
 Write the id of the given node.

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

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

Constructor for NodeSetWriter. It creates the NodeSetWriter and attach it into the given LemonWriter. If the _forceIdMap parameter is true then the writer will write own id map when the user does not give "id" named map.

virtual ~NodeSetWriter  )  [inline, virtual]
 

Destructor for NodeSetWriter.


Member Function Documentation

NodeSetWriter& writeNodeMap std::string  name,
const Map &  map
[inline]
 

Add a new node map writer command for the writer.

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

Add a new node 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 nodeset can write the ids of the nodes. It is possible only if an "id" named map was written or the _forceIdMap constructor parameter was true.

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

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


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