lib/cgraph++/AGraph.cpp
raw| 1 | #include "config.h" |
| 2 | |
| 3 | #include <stdexcept> |
| 4 | #include <string> |
| 5 | |
| 6 | #include "AGraph.h" |
| 7 | |
| 8 | namespace CGraph { |
| 9 | |
| 10 | AGraph::AGraph(const std::string &dot) { |
| 11 | const auto g = agmemread(dot.c_str()); |
| 12 | if (!g) { |
| 13 | throw std::runtime_error("Could not read graph"); |
| 14 | } |
| 15 | m_g = g; |
| 16 | } |
| 17 | |
| 18 | AGraph::~AGraph() { |
| 19 | if (m_g) { |
| 20 | agclose(m_g); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | } // namespace CGraph |