From cb9ea47e7825b5073d4d645afb94f6326cb7cf4d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 6 Sep 2009 12:52:53 +0200 Subject: Start the libcutl repository --- cutl/container/graph.hxx | 157 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 cutl/container/graph.hxx (limited to 'cutl/container/graph.hxx') diff --git a/cutl/container/graph.hxx b/cutl/container/graph.hxx new file mode 100644 index 0000000..9d1c716 --- /dev/null +++ b/cutl/container/graph.hxx @@ -0,0 +1,157 @@ +// file : cutl/container/graph.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef CUTL_CONTAINER_GRAPH_HXX +#define CUTL_CONTAINER_GRAPH_HXX + +#include +#include + +namespace cutl +{ + namespace container + { + template + class graph + { + public: + typedef N node_base; + typedef E edge_base; + + struct no_edge {}; + + public: + template + T& + new_node (); + + template + T& + new_node (A0 const&); + + template + T& + new_node (A0 const&, A1 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, + A5 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, + A5 const&, A6 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, + A5 const&, A6 const&, A7 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, + A5 const&, A6 const&, A7 const&, A8 const&); + + template + T& + new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, + A5 const&, A6 const&, A7 const&, A8 const&, A9 const&); + + // template + // void + // delete_node (T& node); + + public: + template + T& + new_edge (L&, R&); + + template + T& + new_edge (L&, R&, A0 const&); + + template + T& + new_edge (L&, R&, A0 const&, A1 const&); + + template + T& + new_edge (L&, R&, A0 const&, A1 const&, A2 const&); + + template + T& + new_edge (L&, R&, A0 const&, A1 const&, A2 const&, A3 const&); + + template + T& + new_edge (L&, R&, A0 const&, A1 const&, A2 const&, A3 const&, + A4 const&); + + template + T& + new_edge (L&, R&, A0 const&, A1 const&, A2 const&, A3 const&, + A4 const&, A5 const&); + + public: + template + void + delete_edge (L&, R&, T& edge); + + public: + graph () {} + + private: + graph (graph const&); + + graph& + operator= (graph const&); + + protected: + typedef shared_ptr node_ptr; + typedef shared_ptr edge_ptr; + + typedef std::map nodes; + typedef std::map edges; + + nodes nodes_; + edges edges_; + }; + } +} + +#include + +#endif // CUTL_CONTAINER_GRAPH_HXX -- cgit v1.1