21#ifndef TLPBIMPORTEXPORT_H
22#define TLPBIMPORTEXPORT_H
28#include <tulip/Graph.h>
29#include <tulip/ExportModule.h>
30#include <tulip/ImportModule.h>
75class TLPBExport :
public tlp::ExportModule {
78 "<p>Supported extensions: tlpb, tlpbz (compressed), tlpb.gz "
79 "(compressed)</p><p>Exports a graph in a file using the Tulip binary format.",
82 std::
string fileExtension()
const override {
86 std::list<std::string> gzipFileExtensions()
const override {
87 std::list<std::string> ext;
88 ext.push_back(
"tlpb.gz");
89 ext.push_back(
"tlpbz");
94 ~TLPBExport()
override {}
98 std::string icon()
const override {
99 return ":/tulip/gui/icons/tlpb32x32.png";
103 assert(graph->isElement(n));
108 assert(graph->isElement(e));
112 void getSubGraphs(
tlp::Graph *, std::vector<tlp::Graph *> &);
114 void writeAttributes(std::ostream &,
tlp::Graph *);
123class TLPBImport :
public tlp::ImportModule {
126 "<p>Supported extensions: tlpb, tlpb.gz (compressed), tlpbz "
127 "(compressed)</p><p>Imports a graph recorded in a file using the Tulip binary "
131 TLPBImport(
tlp::PluginContext *context);
132 ~TLPBImport()
override {}
134 std::string icon()
const override {
135 return ":/tulip/gui/icons/tlpb32x32.png";
138 std::list<std::string> fileExtensions()
const override {
139 std::list<std::string> l;
144 std::list<std::string> gzipFileExtensions()
const override {
145 std::list<std::string> ext;
146 ext.push_back(
"tlpb.gz");
147 ext.push_back(
"tlpbz");
157#define TLPB_MAGIC_NUMBER 578374683
163 unsigned int magicNumber;
166 unsigned int numNodes;
167 unsigned int numEdges;
169 TLPBHeader(
unsigned int nbN = 0,
unsigned int nbE = 0)
170 : magicNumber(TLPB_MAGIC_NUMBER), major(TLPB_MAJOR), minor(TLPB_MINOR), numNodes(nbN),
173 bool checkCompatibility() {
174 return ((magicNumber == TLPB_MAGIC_NUMBER) && (major == TLPB_MAJOR) && (minor <= TLPB_MINOR));
178#define MAX_EDGES_TO_WRITE 64000
179#define MAX_EDGES_TO_READ MAX_EDGES_TO_WRITE
180#define MAX_RANGES_TO_WRITE MAX_EDGES_TO_WRITE
181#define MAX_RANGES_TO_READ MAX_RANGES_TO_WRITE
182#define MAX_VALUES_TO_WRITE MAX_EDGES_TO_WRITE
183#define MAX_VALUES_TO_READ MAX_VALUES_TO_WRITE
Contains runtime parameters for a plugin.
Graph * importGraph(const std::string &format, DataSet &dataSet, PluginProgress *progress=nullptr, Graph *newGraph=nullptr)
Imports a graph using the specified import plugin with the parameters stored in the DataSet.
bool exportGraph(Graph *graph, std::ostream &outputStream, const std::string &format, DataSet &dataSet, PluginProgress *progress=nullptr)
Exports a graph using the specified export plugin with parameters stored in the DataSet.
#define PLUGININFORMATION(NAME, AUTHOR, DATE, INFO, RELEASE, GROUP)
Declare meta-information for a plugin This is an helper macro that defines every function related to ...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.