|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Class that writes and reads a graph (in a very elementary way) as XML. More...
#include <xml_graph.H>
Public Member Functions | |
| Xml_Graph (Node_Reader &_node_reader, Arc_Reader &_arc_reader, Node_Writer &_node_writer, Arc_Writer &_arc_writer) | |
| Build a reader/writer that shares the caller's functors. | |
| Xml_Graph (Node_Reader &&_node_reader=Node_Reader(), Arc_Reader &&_arc_reader=Arc_Reader(), Node_Writer &&_node_writer=Node_Writer(), Arc_Writer &&_arc_writer=Arc_Writer()) | |
| Build a reader/writer that owns its functors. | |
| Xml_Graph (const Xml_Graph &other) | |
| Copy constructor. | |
| const std::string & | get_graph_name () const |
| void | set_graph_name (const std::string &_graph_name) |
| const std::string & | get_node_name () const |
| void | set_node_name (const std::string &_node_name) |
| const std::string & | get_arc_name () const |
| void | set_arc_name (const std::string &_arc_name) |
| GT | operator() (const std::string &file_name) |
| void | operator() (GT &g, const std::string &file_name) |
Static Public Member Functions | |
| template<class F > | |
| static std::optional< F > | copy_own (const std::optional< F > &src) |
Copy an other reader/writer whose functor may not be copy-constructible. | |
Private Member Functions | |
| GT | read_graph (xmlpp::TextReader &reader) |
| GT | read (const std::string &file_name) |
| void | write_graph (GT &g, xmlpp::Document &doc) |
| void | write (GT &g, const std::string &file_name) |
Private Attributes | |
| std::string | graph_name |
| std::string | node_name |
| std::string | arc_name |
| std::optional< Node_Reader > | own_node_reader |
| std::optional< Arc_Reader > | own_arc_reader |
| std::optional< Node_Writer > | own_node_writer |
| std::optional< Arc_Writer > | own_arc_writer |
| Node_Reader & | node_reader |
| Arc_Reader & | arc_reader |
| Node_Writer & | node_writer |
| Arc_Writer & | arc_writer |
Class that writes and reads a graph (in a very elementary way) as XML.
| GT | the graph type. |
| Node_Reader | the function that reads a node's attributes. |
| Arc_Reader | the function that reads an arc's attributes. |
| Node_Writer | the function that writes a node's attributes. |
| Arc_Writer | the function that writes an arc's attributes. |
Definition at line 125 of file xml_graph.H.
|
inline |
Build a reader/writer that shares the caller's functors.
The functors are neither copied nor owned: they must outlive this object, and any state they accumulate is visible to the caller.
| [in] | _node_reader | reads the attributes of a node |
| [in] | _arc_reader | reads the attributes of an arc |
| [in] | _node_writer | writes the attributes of a node |
| [in] | _arc_writer | writes the attributes of an arc |
Definition at line 298 of file xml_graph.H.
|
inline |
Build a reader/writer that owns its functors.
The functors (by default, the Dft_* ones) are moved into this object. Before, only a reference to these temporaries was kept, and it dangled as soon as the constructor returned.
| [in] | _node_reader | reads the attributes of a node |
| [in] | _arc_reader | reads the attributes of an arc |
| [in] | _node_writer | writes the attributes of a node |
| [in] | _arc_writer | writes the attributes of an arc |
Definition at line 318 of file xml_graph.H.
|
inline |
Copy constructor.
Owned functors are copied, so the copy does not refer to other's; shared functors stay shared with the caller. A functor type that is movable but not copy-constructible is only a problem if other actually owns it (see copy_own); merely being of such a type does not stop other from being copied while it shares its functors.
| [in] | other | reader/writer to copy |
| std::runtime_error | see copy_own |
Definition at line 370 of file xml_graph.H.
|
inlinestatic |
Copy an other reader/writer whose functor may not be copy-constructible.
| F | the functor's own type (Node_Reader, ...). |
| [in] | src | the corresponding own_* member of other. |
src, if F is copy-constructible. | std::runtime_error | if F is not copy-constructible and src holds a value (a copyable other can still always be shared, even if it owns a non-copy-constructible functor: only copying such an owned functor is impossible). |
Definition at line 345 of file xml_graph.H.
References ah_runtime_error_if.
|
inline |
Definition at line 405 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_name.
|
inline |
Definition at line 385 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::graph_name.
|
inline |
Definition at line 395 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_name.
|
inline |
Definition at line 415 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read().
|
inline |
Definition at line 420 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write().
|
inlineprivate |
Definition at line 219 of file xml_graph.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph().
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::operator()().
|
inlineprivate |
Definition at line 149 of file xml_graph.H.
References Aleph::DynArray< T >::append(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_name, Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_reader, Aleph::blossom_maximum_cardinality_matching(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_name, Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_reader, num_nodes, and test().
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read().
|
inline |
Definition at line 410 of file xml_graph.H.
References Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_name, and Aleph::blossom_maximum_cardinality_matching().
|
inline |
Definition at line 390 of file xml_graph.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::graph_name.
|
inline |
Definition at line 400 of file xml_graph.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_name.
|
inlineprivate |
Definition at line 280 of file xml_graph.H.
References doc, and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::operator()().
|
inlineprivate |
Definition at line 225 of file xml_graph.H.
References Aleph::DynArray< T >::access(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_name, Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_writer, arcs, Aleph::blossom_maximum_cardinality_matching(), doc, Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::graph_name, Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_name, Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_writer, nodes, and Aleph::DynArray< T >::size().
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write().
|
private |
Definition at line 131 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_arc_name(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_arc_name(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
private |
Definition at line 143 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph().
|
private |
Definition at line 147 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
private |
Definition at line 127 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_graph_name(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_graph_name(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
private |
Definition at line 129 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_node_name(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph(), Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_node_name(), and Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
private |
Definition at line 141 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph().
|
private |
Definition at line 145 of file xml_graph.H.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph().
|
private |
Definition at line 137 of file xml_graph.H.
|
private |
Definition at line 139 of file xml_graph.H.
|
private |
Definition at line 136 of file xml_graph.H.
|
private |
Definition at line 138 of file xml_graph.H.