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 "Exports a graph in a file using the Tulip binary format",
78 std::
string fileExtension()
const {
87 std::string icon()
const {
88 return ":/tulip/gui/icons/tlpb32x32.png";
91 tlp::MutableContainer<tlp::node> nodeIndex;
92 tlp::MutableContainer<tlp::edge> edgeIndex;
95 return nodeIndex.get(n.
id);
99 return edgeIndex.get(e.
id);
102 void getSubGraphs(
tlp::Graph*, std::vector<tlp::Graph*>&);
104 void writeAttributes(std::ostream&,
tlp::Graph*);
113 class TLPBImport:
public tlp::ImportModule {
116 "Imports a graph recorded in a file using the Tulip binary format",
"1.2",
"File")
118 TLPBImport(
tlp::PluginContext* context);
121 std::string icon()
const {
122 return ":/tulip/gui/icons/tlpb32x32.png";
125 std::list<std::string> fileExtensions()
const {
126 std::list<std::string> l;
128 l.push_back(
"tlpb.gz");
138 #define TLPB_MAGIC_NUMBER 578374683 144 unsigned int magicNumber;
147 unsigned int numNodes;
148 unsigned int numEdges;
150 TLPBHeader(
unsigned int nbN = 0,
unsigned int nbE = 0)
151 : magicNumber(TLPB_MAGIC_NUMBER), major(TLPB_MAJOR), minor(TLPB_MINOR), numNodes(nbN), numEdges(nbE) {}
153 bool checkCompatibility() {
154 return ((magicNumber == TLPB_MAGIC_NUMBER) &&
155 (major == TLPB_MAJOR) &&
156 (minor <= TLPB_MINOR));
160 #define MAX_EDGES_TO_WRITE 64000 161 #define MAX_EDGES_TO_READ MAX_EDGES_TO_WRITE 162 #define MAX_RANGES_TO_WRITE MAX_EDGES_TO_WRITE 163 #define MAX_RANGES_TO_READ MAX_RANGES_TO_WRITE 164 #define MAX_VALUES_TO_WRITE MAX_EDGES_TO_WRITE 165 #define MAX_VALUES_TO_READ MAX_VALUES_TO_WRITE 167 #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.
unsigned int id
id The identifier of the node.
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.
unsigned int id
id The identifier of the edge.