|
| | 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) |
| |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
class Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >
Class that writes and reads a graph (in a very elementary way) as XML.
- Parameters
-
| 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. |
- Author
- Alejandro J. Mujica
Definition at line 125 of file xml_graph.H.
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::Xml_Graph |
( |
Node_Reader & |
_node_reader, |
|
|
Arc_Reader & |
_arc_reader, |
|
|
Node_Writer & |
_node_writer, |
|
|
Arc_Writer & |
_arc_writer |
|
) |
| |
|
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.
- Parameters
-
| [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.
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::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() |
|
) |
| |
|
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.
- Parameters
-
| [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.
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
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.
- Parameters
-
| [in] | other | reader/writer to copy |
- Exceptions
-
| std::runtime_error | see copy_own |
Definition at line 370 of file xml_graph.H.
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| static std::optional< F > Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::copy_own |
( |
const std::optional< F > & |
src | ) |
|
|
inlinestatic |
Copy an other reader/writer whose functor may not be copy-constructible.
- Template Parameters
-
| F | the functor's own type (Node_Reader, ...). |
- Parameters
-
| [in] | src | the corresponding own_* member of other. |
- Returns
- a copy of
src, if F is copy-constructible.
- Exceptions
-
| 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.
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| const std::string & Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_arc_name |
( |
| ) |
const |
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| const std::string & Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_graph_name |
( |
| ) |
const |
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| const std::string & Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::get_node_name |
( |
| ) |
const |
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| GT Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::operator() |
( |
const std::string & |
file_name | ) |
|
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::operator() |
( |
GT & |
g, |
|
|
const std::string & |
file_name |
|
) |
| |
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| GT Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read |
( |
const std::string & |
file_name | ) |
|
|
inlineprivate |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| GT Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read_graph |
( |
xmlpp::TextReader & |
reader | ) |
|
|
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::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::Attr::name, 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, test(), and Aleph::Attr::value.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::read().
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_arc_name |
( |
const std::string & |
_arc_name | ) |
|
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_graph_name |
( |
const std::string & |
_graph_name | ) |
|
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::set_node_name |
( |
const std::string & |
_node_name | ) |
|
|
inline |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write |
( |
GT & |
g, |
|
|
const std::string & |
file_name |
|
) |
| |
|
inlineprivate |
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| void Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write_graph |
( |
GT & |
g, |
|
|
xmlpp::Document & |
doc |
|
) |
| |
|
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, 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::Attr::name, 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, Aleph::DynArray< T >::size(), and Aleph::Attr::value.
Referenced by Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::write().
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| std::string Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::arc_name |
|
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().
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| std::string Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::graph_name |
|
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().
template<AlephGraph GT, class Node_Reader = Dft_Node_Reader<GT>, class Arc_Reader = Dft_Arc_Reader<GT>, class Node_Writer = Dft_Node_Writer<GT>, class Arc_Writer = Dft_Arc_Writer<GT>>
| std::string Aleph::Xml_Graph< GT, Node_Reader, Arc_Reader, Node_Writer, Arc_Writer >::node_name |
|
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().