21 #ifndef TLPBIMPORTEXPORT_H 22 #define TLPBIMPORTEXPORT_H 25 #include <tulip/TulipPluginHeaders.h> 26 #include <tulip/ExportModule.h> 27 #include <tulip/ImportModule.h> 72 class TLPBExport :
public tlp::ExportModule {
75 "<p>Supported extensions: tlpb, tlpbz (compressed), tlpb.gz " 76 "(compressed)</p><p>Exports a graph in a file using the Tulip binary format.",
79 std::
string fileExtension()
const override {
83 std::list<std::string> gzipFileExtensions()
const override {
84 std::list<std::string> ext;
85 ext.push_back(
"tlpb.gz");
86 ext.push_back(
"tlpbz");
91 ~TLPBExport()
override {}
95 std::string icon()
const override {
96 return ":/tulip/gui/icons/tlpb32x32.png";
100 assert(graph->isElement(n));
105 assert(graph->isElement(e));
109 void getSubGraphs(
tlp::Graph *, std::vector<tlp::Graph *> &);
111 void writeAttributes(std::ostream &,
tlp::Graph *);
120 class TLPBImport :
public tlp::ImportModule {
123 "<p>Supported extensions: tlpb, tlpb.gz (compressed), tlpbz " 124 "(compressed)</p><p>Imports a graph recorded in a file using the Tulip binary " 128 TLPBImport(
tlp::PluginContext *context);
129 ~TLPBImport()
override {}
131 std::string icon()
const override {
132 return ":/tulip/gui/icons/tlpb32x32.png";
135 std::list<std::string> fileExtensions()
const override {
136 std::list<std::string> l;
141 std::list<std::string> gzipFileExtensions()
const override {
142 std::list<std::string> ext;
143 ext.push_back(
"tlpb.gz");
144 ext.push_back(
"tlpbz");
154 #define TLPB_MAGIC_NUMBER 578374683 160 unsigned int magicNumber;
163 unsigned int numNodes;
164 unsigned int numEdges;
166 TLPBHeader(
unsigned int nbN = 0,
unsigned int nbE = 0)
167 : magicNumber(TLPB_MAGIC_NUMBER), major(TLPB_MAJOR), minor(TLPB_MINOR), numNodes(nbN),
170 bool checkCompatibility() {
171 return ((magicNumber == TLPB_MAGIC_NUMBER) && (major == TLPB_MAJOR) && (minor <= TLPB_MINOR));
175 #define MAX_EDGES_TO_WRITE 64000 176 #define MAX_EDGES_TO_READ MAX_EDGES_TO_WRITE 177 #define MAX_RANGES_TO_WRITE MAX_EDGES_TO_WRITE 178 #define MAX_RANGES_TO_READ MAX_RANGES_TO_WRITE 179 #define MAX_VALUES_TO_WRITE MAX_EDGES_TO_WRITE 180 #define MAX_VALUES_TO_READ MAX_VALUES_TO_WRITE 182 #endif // TLPBIMPORTEXPORT_H
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...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.
#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 ...
Contains runtime parameters for a plugin.
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.