Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::MeshIOHandler Class Referenceabstract

Mesh loader and saver. More...

#include <geogram/mesh/mesh_io.h>

Inheritance diagram for GEO::MeshIOHandler:
GEO::Counted

Public Member Functions

virtual bool load (const std::string &filename, Mesh &M, const MeshIOFlags &ioflags=MeshIOFlags())=0
 Loads a double precision mesh from a file. More...
 
virtual bool save (const Mesh &M, const std::string &filename, const MeshIOFlags &ioflags=MeshIOFlags())=0
 Saves a mesh to a file. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Static Public Member Functions

static MeshIOHandlercreate (const std::string &format)
 Creates a MeshIOHandler. More...
 
static MeshIOHandlerget_handler (const std::string &filename)
 Gets the MeshIOHandler for a file. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 

Protected Member Functions

 MeshIOHandler ()
 MeshIOHandler default constructor.
 
 ~MeshIOHandler () override
 MeshIOHandler destructor.
 
virtual void bind_attributes (const Mesh &M, const MeshIOFlags &flags, bool create)
 
virtual void unbind_attributes ()
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Protected Attributes

Attribute< index_tvertex_region_
 
Attribute< index_tedge_region_
 
Attribute< index_tfacet_region_
 
Attribute< index_tcell_region_
 

Related Functions

(Note that these are not member functions.)

typedef SmartPointer< MeshIOHandlerMeshIOHandler_var
 A smart pointer that contains a MeshIOHandler object.
 
typedef Factory0< MeshIOHandlerMeshIOHandlerFactory
 MeshIOHandler Factory. More...
 

Detailed Description

Mesh loader and saver.

MeshIOHandler is responsible to load and save meshes in a specific file format. MeshIOHandler is used internally by mesh_load() and mesh_save(), so you don't normally need to use it directly, unless you need to implement a new file format.

Vorpaline currently supports thr following file formats:

MeshIOHandlers are created using method create() which uses the Factory service. Handlers for new file formats can be implemented and registered to the factory using geo_register_MeshIOHandler_creator().

See also
MeshIOHandlerFactory
geo_register_MeshIOHandler_creator

Definition at line 352 of file mesh_io.h.

Member Function Documentation

◆ create()

static MeshIOHandler* GEO::MeshIOHandler::create ( const std::string &  format)
static

Creates a MeshIOHandler.

Parameters
[in]formatformat of the file
Return values
nullptrif format is not a supported file format.
otherwise,apointer to a IO handler. The returned pointer must be stored in an MeshIOHandler_var that does automatic destruction:
SmartPointer< MeshIOHandler > MeshIOHandler_var
A smart pointer that contains a MeshIOHandler object.
Definition: mesh_io.h:432
static MeshIOHandler * create(const std::string &format)
Creates a MeshIOHandler.

◆ get_handler()

static MeshIOHandler* GEO::MeshIOHandler::get_handler ( const std::string &  filename)
static

Gets the MeshIOHandler for a file.

Determines the file format from the extension of file filename and creates a MeshIOHandler for this format.

Parameters
[in]filenamea path to a mesh file
Return values
nullptrif format is not a supported file format.
apointer to a IO handler if format is supported.
nullptrotherwise
See also
create()

◆ load()

virtual bool GEO::MeshIOHandler::load ( const std::string &  filename,
Mesh M,
const MeshIOFlags ioflags = MeshIOFlags() 
)
pure virtual

Loads a double precision mesh from a file.

Parameters
[in]filenamename of the file
[out]Mthe loaded mesh
[in]ioflagsspecifies which attributes and elements should be loaded

◆ save()

virtual bool GEO::MeshIOHandler::save ( const Mesh M,
const std::string &  filename,
const MeshIOFlags ioflags = MeshIOFlags() 
)
pure virtual

Saves a mesh to a file.

Parameters
[in]Mthe mesh to save
[in]filenamename of the file
[in]ioflagsspecifies which attributes and elements should be saved
Returns
true on success, false otherwise.

Friends And Related Function Documentation

◆ MeshIOHandlerFactory

MeshIOHandler Factory.

This Factory is used to create MeshIOHandler objects. It can also be used to register new MeshIOHandler implementations.

See also
geo_register_MeshIOHandler_creator
Factory

Definition at line 444 of file mesh_io.h.


The documentation for this class was generated from the following file: