21 #ifndef TLPBIMPORTEXPORT_H 22 #define TLPBIMPORTEXPORT_H 25 #include <tulip/TulipPluginHeaders.h> 26 #include <tulip/ExportModule.h> 27 #include <tulip/ImportModule.h> 71 class TLPBExport:
public tlp::ExportModule {
75 "<p>Supported extensions: tlpb, tlpbz (compressed), tlpb.gz (compressed)</p><p>Exports a graph in a file using the Tulip binary format.",
78 std::
string fileExtension()
const {
82 std::list<std::string> gzipFileExtensions()
const {
83 std::list<std::string> ext;
84 ext.push_back(
"tlpb.gz");
85 ext.push_back(
"tlpbz");
94 std::string icon()
const {
95 return ":/tulip/gui/icons/tlpb32x32.png";
99 assert(graph->isElement(n));
104 assert(graph->isElement(e));
108 void getSubGraphs(
tlp::Graph*, std::vector<tlp::Graph*>&);
110 void writeAttributes(std::ostream&,
tlp::Graph*);
119 class TLPBImport:
public tlp::ImportModule {
122 "<p>Supported extensions: tlpb, tlpb.gz (compressed), tlpbz (compressed)</p><p>Imports a graph recorded in a file using the Tulip binary format.</p>",
"1.2",
"File")
124 TLPBImport(
tlp::PluginContext* context);
127 std::string icon()
const {
128 return ":/tulip/gui/icons/tlpb32x32.png";
131 std::list<std::string> fileExtensions()
const {
132 std::list<std::string> l;
137 std::list<std::string> gzipFileExtensions()
const {
138 std::list<std::string> ext;
139 ext.push_back(
"tlpb.gz");
140 ext.push_back(
"tlpbz");
150 #define TLPB_MAGIC_NUMBER 578374683 156 unsigned int magicNumber;
159 unsigned int numNodes;
160 unsigned int numEdges;
162 TLPBHeader(
unsigned int nbN = 0,
unsigned int nbE = 0)
163 : magicNumber(TLPB_MAGIC_NUMBER), major(TLPB_MAJOR), minor(TLPB_MINOR), numNodes(nbN), numEdges(nbE) {}
165 bool checkCompatibility() {
166 return ((magicNumber == TLPB_MAGIC_NUMBER) &&
167 (major == TLPB_MAJOR) &&
168 (minor <= TLPB_MINOR));
172 #define MAX_EDGES_TO_WRITE 64000 173 #define MAX_EDGES_TO_READ MAX_EDGES_TO_WRITE 174 #define MAX_RANGES_TO_WRITE MAX_EDGES_TO_WRITE 175 #define MAX_RANGES_TO_READ MAX_RANGES_TO_WRITE 176 #define MAX_VALUES_TO_WRITE MAX_EDGES_TO_WRITE 177 #define MAX_VALUES_TO_READ MAX_VALUES_TO_WRITE 179 #endif // TLPBIMPORTEXPORT_H
Graph * importGraph(const std::string &format, DataSet &dataSet, PluginProgress *progress=NULL, Graph *newGraph=NULL)
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=NULL)
Exports a graph using the specified export plugin with parameters stored in the DataSet.