Debian Codegraph @

lib/gvc++/GVLayout.h

raw
1 #pragma once
2
3 #include <memory>
4 #include <string>
5
6 #include "AGraph.h"
7 #include "GVContext.h"
8 #include "GVRenderData.h"
9
10 #ifdef GVDLL
11 #if gvc___EXPORTS // CMake's substitution of gvc++_EXPORTS
12 #define GVLAYOUT_API __declspec(dllexport)
13 #else
14 #define GVLAYOUT_API __declspec(dllimport)
15 #endif
16 #endif
17
18 #ifndef GVLAYOUT_API
19 #define GVLAYOUT_API /* nothing */
20 #endif
21
22 namespace GVC {
23
24 /**
25 * @brief The GVLayout class represents a graph layout
26 */
27
28 class GVLayout {
29 public:
30 GVLAYOUT_API GVLayout(const std::shared_ptr<GVContext> &gvc,
31 const std::shared_ptr<CGraph::AGraph> &g,
32 const std::string &engine);
33 GVLAYOUT_API GVLayout(GVContext &&gvc, CGraph::AGraph &&g,
34 const std::string &engine);
35 GVLAYOUT_API GVLayout(std::shared_ptr<GVContext> gvc, CGraph::AGraph &&g,
36 const std::string &engine);
37 GVLAYOUT_API GVLayout(GVContext &&gvc, std::shared_ptr<CGraph::AGraph> g,
38 const std::string &engine);
39 GVLAYOUT_API ~GVLayout();
40
41 // default copy since we manage resources through movable types
42 GVLAYOUT_API GVLayout(const GVLayout &) = default;
43 GVLAYOUT_API GVLayout &operator=(const GVLayout &) = default;
44
45 // default move since we manage resources through movable types
46 GVLAYOUT_API GVLayout(GVLayout &&) = default;
47 GVLAYOUT_API GVLayout &operator=(GVLayout &&) = default;
48
49 // render the layout in the specified format
50 GVLAYOUT_API GVRenderData render(const std::string &format) const;
51
52 private:
53 std::shared_ptr<GVContext> m_gvc;
54 std::shared_ptr<CGraph::AGraph> m_g;
55 };
56
57 } // namespace GVC
58
59 #undef GVLAYOUT_API