#include <lemon/lemon_writer.h>
Inherits LemonWriter::SectionWriter.
Inheritance diagram for NodeSetWriter:
@nodeset
nodeset_name
, but the nodeset_name
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 "label"
named map then it will be regarded as label map. This map should contain only unique values and when the writeLabel()
member will be called with a node it will write it's label. Otherwise if the _forceLabelMap
constructor parameter is true then the label map will be the id in the graph. In addition if the the _sortByLabel
is true then the writer will write the edges sorted by the labels.
Public Member Functions | |
NodeSetWriter (LemonWriter &_writer, const Graph &_graph, const std::string &_name=std::string(), bool _forceLabelMap=true, bool _sortByLabel=true) | |
Constructor. | |
virtual | ~NodeSetWriter () |
Destructor. | |
template<typename Map> | |
NodeSetWriter & | writeNodeMap (std::string name, const Map &map) |
Add a new node map writer command for the writer. | |
template<typename Writer, typename Map> | |
NodeSetWriter & | writeNodeMap (std::string name, const Map &map, const Writer &writer=Writer()) |
Add a new node map writer command for the writer. | |
bool | isLabelWriter () const |
Returns true if the nodeset can write the labels of the nodes. | |
void | writeLabel (std::ostream &os, const Node &item) const |
Write the label 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. |
NodeSetWriter | ( | LemonWriter & | _writer, | |
const Graph & | _graph, | |||
const std::string & | _name = std::string() , |
|||
bool | _forceLabelMap = true , |
|||
bool | _sortByLabel = true | |||
) | [inline] |
Constructor for NodeSetWriter. It creates the NodeSetWriter and attach it into the given LemonWriter. If the _forceLabelMap
parameter is true then the writer will write own label map when the user does not give "label" named map. In addition if the the _sortByLabel
is true then the writer will write the edges sorted by the labels.
virtual ~NodeSetWriter | ( | ) | [inline, virtual] |
Destructor for NodeSetWriter.
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 isLabelWriter | ( | ) | const [inline] |
Returns true if the nodeset can write the labels of the nodes. It is possible only if an "label" named map was written or the _forceLabelMap
constructor parameter was true.
void writeLabel | ( | std::ostream & | os, | |
const Node & | item | |||
) | const [inline] |
It writes the label of the given node. If there was written an "label" named map then it will write the map value belongs to the node. Otherwise if the forceLabel
parameter was true it will write its label in the graph.