MeshLib Documentation
Loading...
Searching...
No Matches
MRIOFormatsRegistry.h File Reference
#include "MRMeshFwd.h"
#include "MRExpected.h"
#include "MRIOFilters.h"
#include "MRMeshLoadSettings.h"
#include "MROnInit.h"
#include "MRPointsLoadSettings.h"
#include "MRSaveSettings.h"
#include <filesystem>
#include <map>

Go to the source code of this file.

Classes

class  MR::FormatRegistry< Processor >
 
struct  MR::MeshLoad::MeshLoader
 
struct  MR::MeshSave::MeshSaver
 
struct  MR::LinesLoad::LinesLoader
 
struct  MR::LinesSave::LinesSaver
 
struct  MR::PointsLoad::PointsLoader
 
struct  MR::PointsSave::PointsSaver
 

Namespaces

namespace  MR
 
namespace  MR::MeshLoad
 
namespace  MR::MeshSave
 
namespace  MR::LinesLoad
 
namespace  MR::LinesSave
 
namespace  MR::PointsLoad
 
namespace  MR::PointsSave
 
namespace  MR::ImageLoad
 
namespace  MR::ImageSave
 
namespace  MR::ObjectLoad
 
namespace  MR::ObjectSave
 
namespace  MR::AsyncObjectLoad
 
namespace  MR::SceneLoad
 
namespace  MR::SceneSave
 

Macros

#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
 
#define MR_FORMAT_REGISTRY_DECL(ProcName)   MR_FORMAT_REGISTRY_EXTERNAL_DECL( MRMESH_API, ProcName )
 
#define MR_FORMAT_REGISTRY_IMPL(ProcName)
 
#define MR_ADD_MESH_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::MeshLoad; setMeshLoader( filter, { static_cast<MeshFileLoader>( loader ), static_cast<MeshStreamLoader>( loader ) } ); };
 Register filter with loader function.
 
#define MR_ADD_MESH_LOADER_WITH_PRIORITY(filter, loader, priority)   MR_ON_INIT { using namespace MR::MeshLoad; setMeshLoader( filter, { static_cast<MeshFileLoader>( loader ), static_cast<MeshStreamLoader>( loader ) }, priority ); };
 
#define MR_ADD_MESH_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::MeshSave; setMeshSaver( filter, { static_cast<MeshFileSaver>( saver ), static_cast<MeshStreamSaver>( saver ) } ); };
 
#define MR_ADD_MESH_SAVER_WITH_PRIORITY(filter, saver, priority)   MR_ON_INIT { using namespace MR::MeshSave; setMeshSaver( filter, { static_cast<MeshFileSaver>( saver ), static_cast<MeshStreamSaver>( saver ) }, priority ); };
 
#define MR_ADD_LINES_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::LinesLoad; setLinesLoader( filter, { static_cast<LinesFileLoader>( loader ), static_cast<LinesStreamLoader>( loader ) } ); };
 
#define MR_ADD_LINES_LOADER_WITH_PRIORITY(filter, loader, priority)   MR_ON_INIT { using namespace MR::LinesLoad; setLinesLoader( filter, { static_cast<LinesFileLoader>( loader ), static_cast<LinesStreamLoader>( loader ) }, priority ); };
 
#define MR_ADD_LINES_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::LinesSave; setLinesSaver( filter, { static_cast<LinesFileSaver>( saver ), static_cast<LinesStreamSaver>( saver ) } ); };
 
#define MR_ADD_LINES_SAVER_WITH_PRIORITY(filter, saver, priority)   MR_ON_INIT { using namespace MR::LinesSave; setLinesSaver( filter, { static_cast<LinesFileSaver>( saver ), static_cast<LinesStreamSaver>( saver ) }, priority ); };
 
#define MR_ADD_POINTS_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::PointsLoad; setPointsLoader( filter, { static_cast<PointsFileLoader>( loader ), static_cast<PointsStreamLoader>( loader ) } ); };
 
#define MR_ADD_POINTS_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::PointsSave; setPointsSaver( filter, { static_cast<PointsFileSaver>( saver ), static_cast<PointsStreamSaver>( saver ) } ); };
 
#define MR_ADD_IMAGE_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::ImageLoad; setImageLoader( filter, loader ); };
 
#define MR_ADD_IMAGE_LOADER_WITH_PRIORITY(filter, loader, priority)   MR_ON_INIT { using namespace MR::ImageLoad; setImageLoader( filter, loader, priority ); };
 
#define MR_ADD_IMAGE_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::ImageSave; setImageSaver( filter, saver ); };
 
#define MR_ADD_IMAGE_SAVER_WITH_PRIORITY(filter, saver, priority)   MR_ON_INIT { using namespace MR::ImageSave; setImageSaver( filter, saver, priority ); };
 
#define MR_ADD_OBJECT_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::ObjectLoad; setObjectLoader( filter, loader ); };
 
#define MR_ADD_OBJECT_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::ObjectSave; setObjectSaver( filter, saver ); };
 
#define MR_ADD_SCENE_LOADER(filter, loader)   MR_ON_INIT { using namespace MR::SceneLoad; setSceneLoader( filter, loader ); };
 
#define MR_ADD_SCENE_LOADER_WITH_PRIORITY(filter, loader, priority)   MR_ON_INIT { using namespace MR::SceneLoad; setSceneLoader( filter, loader, priority ); };
 
#define MR_ADD_SCENE_SAVER(filter, saver)   MR_ON_INIT { using namespace MR::SceneSave; setSceneSaver( filter, saver ); };
 
#define MR_ADD_SCENE_SAVER_WITH_PRIORITY(filter, saver, priority)   MR_ON_INIT { using namespace MR::SceneSave; setSceneSaver( filter, saver, priority ); };
 

Typedefs

using MR::MeshLoad::MeshFileLoader = Expected<MR::Mesh>( * )( const std::filesystem::path&, const MeshLoadSettings& )
 
using MR::MeshLoad::MeshStreamLoader = Expected<MR::Mesh>( * )( std::istream&, const MeshLoadSettings& )
 
using MR::MeshSave::MeshFileSaver = Expected<void>( * )( const Mesh&, const std::filesystem::path&, const SaveSettings& )
 
using MR::MeshSave::MeshStreamSaver = Expected<void>( * )( const Mesh&, std::ostream&, const SaveSettings& )
 
using MR::LinesLoad::LinesFileLoader = Expected<Polyline3>( * )( const std::filesystem::path&, ProgressCallback )
 
using MR::LinesLoad::LinesStreamLoader = Expected<Polyline3>( * )( std::istream&, ProgressCallback )
 
using MR::LinesSave::LinesFileSaver = Expected<void>( * )( const Polyline3&, const std::filesystem::path&, const SaveSettings& )
 
using MR::LinesSave::LinesStreamSaver = Expected<void>( * )( const Polyline3&, std::ostream&, const SaveSettings& )
 
using MR::PointsLoad::PointsFileLoader = Expected<PointCloud>( * )( const std::filesystem::path&, const PointsLoadSettings& )
 
using MR::PointsLoad::PointsStreamLoader = Expected<PointCloud>( * )( std::istream&, const PointsLoadSettings& )
 
using MR::PointsSave::PointsFileSaver = Expected<void>( * )( const PointCloud&, const std::filesystem::path&, const SaveSettings& )
 
using MR::PointsSave::PointsStreamSaver = Expected<void>( * )( const PointCloud&, std::ostream&, const SaveSettings& )
 
using MR::ImageLoad::ImageLoader = Expected<Image>( * )( const std::filesystem::path& )
 
using MR::ImageSave::ImageSaver = Expected<void>( * )( const Image&, const std::filesystem::path& )
 
using MR::ObjectPtr = std::shared_ptr<Object>
 
using MR::ObjectLoad::ObjectLoader = Expected<std::vector<ObjectPtr>>( * )( const std::filesystem::path&, std::string*, ProgressCallback )
 
using MR::ObjectSave::ObjectSaver = Expected<void>( * )( const Object&, const std::filesystem::path&, const ProgressCallback& )
 
using MR::AsyncObjectLoad::PostLoadCallback = std::function<void ( Expected<std::vector<ObjectPtr>> )>
 
using MR::AsyncObjectLoad::ObjectLoader = void( * )( const std::filesystem::path&, std::string*, PostLoadCallback, ProgressCallback )
 
using MR::SceneLoad::SceneLoader = Expected<ObjectPtr>( * )( const std::filesystem::path&, std::string*, ProgressCallback )
 
using MR::SceneSave::SceneSaver = Expected<void>( * )( const Object&, const std::filesystem::path&, ProgressCallback )
 

Variables

MRMESH_API const IOFilters MR::AllFilter
 

Macro Definition Documentation

◆ MR_ADD_IMAGE_LOADER

#define MR_ADD_IMAGE_LOADER ( filter,
loader )   MR_ON_INIT { using namespace MR::ImageLoad; setImageLoader( filter, loader ); };

◆ MR_ADD_IMAGE_LOADER_WITH_PRIORITY

#define MR_ADD_IMAGE_LOADER_WITH_PRIORITY ( filter,
loader,
priority )   MR_ON_INIT { using namespace MR::ImageLoad; setImageLoader( filter, loader, priority ); };

◆ MR_ADD_IMAGE_SAVER

#define MR_ADD_IMAGE_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::ImageSave; setImageSaver( filter, saver ); };

◆ MR_ADD_IMAGE_SAVER_WITH_PRIORITY

#define MR_ADD_IMAGE_SAVER_WITH_PRIORITY ( filter,
saver,
priority )   MR_ON_INIT { using namespace MR::ImageSave; setImageSaver( filter, saver, priority ); };

◆ MR_ADD_LINES_LOADER

#define MR_ADD_LINES_LOADER ( filter,
loader )   MR_ON_INIT { using namespace MR::LinesLoad; setLinesLoader( filter, { static_cast<LinesFileLoader>( loader ), static_cast<LinesStreamLoader>( loader ) } ); };

◆ MR_ADD_LINES_LOADER_WITH_PRIORITY

#define MR_ADD_LINES_LOADER_WITH_PRIORITY ( filter,
loader,
priority )   MR_ON_INIT { using namespace MR::LinesLoad; setLinesLoader( filter, { static_cast<LinesFileLoader>( loader ), static_cast<LinesStreamLoader>( loader ) }, priority ); };

◆ MR_ADD_LINES_SAVER

#define MR_ADD_LINES_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::LinesSave; setLinesSaver( filter, { static_cast<LinesFileSaver>( saver ), static_cast<LinesStreamSaver>( saver ) } ); };

◆ MR_ADD_LINES_SAVER_WITH_PRIORITY

#define MR_ADD_LINES_SAVER_WITH_PRIORITY ( filter,
saver,
priority )   MR_ON_INIT { using namespace MR::LinesSave; setLinesSaver( filter, { static_cast<LinesFileSaver>( saver ), static_cast<LinesStreamSaver>( saver ) }, priority ); };

◆ MR_ADD_MESH_SAVER

#define MR_ADD_MESH_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::MeshSave; setMeshSaver( filter, { static_cast<MeshFileSaver>( saver ), static_cast<MeshStreamSaver>( saver ) } ); };

◆ MR_ADD_MESH_SAVER_WITH_PRIORITY

#define MR_ADD_MESH_SAVER_WITH_PRIORITY ( filter,
saver,
priority )   MR_ON_INIT { using namespace MR::MeshSave; setMeshSaver( filter, { static_cast<MeshFileSaver>( saver ), static_cast<MeshStreamSaver>( saver ) }, priority ); };

◆ MR_ADD_OBJECT_LOADER

#define MR_ADD_OBJECT_LOADER ( filter,
loader )   MR_ON_INIT { using namespace MR::ObjectLoad; setObjectLoader( filter, loader ); };

◆ MR_ADD_OBJECT_SAVER

#define MR_ADD_OBJECT_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::ObjectSave; setObjectSaver( filter, saver ); };

◆ MR_ADD_POINTS_LOADER

#define MR_ADD_POINTS_LOADER ( filter,
loader )   MR_ON_INIT { using namespace MR::PointsLoad; setPointsLoader( filter, { static_cast<PointsFileLoader>( loader ), static_cast<PointsStreamLoader>( loader ) } ); };

◆ MR_ADD_POINTS_SAVER

#define MR_ADD_POINTS_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::PointsSave; setPointsSaver( filter, { static_cast<PointsFileSaver>( saver ), static_cast<PointsStreamSaver>( saver ) } ); };

◆ MR_ADD_SCENE_LOADER

#define MR_ADD_SCENE_LOADER ( filter,
loader )   MR_ON_INIT { using namespace MR::SceneLoad; setSceneLoader( filter, loader ); };

◆ MR_ADD_SCENE_LOADER_WITH_PRIORITY

#define MR_ADD_SCENE_LOADER_WITH_PRIORITY ( filter,
loader,
priority )   MR_ON_INIT { using namespace MR::SceneLoad; setSceneLoader( filter, loader, priority ); };

◆ MR_ADD_SCENE_SAVER

#define MR_ADD_SCENE_SAVER ( filter,
saver )   MR_ON_INIT { using namespace MR::SceneSave; setSceneSaver( filter, saver ); };

◆ MR_ADD_SCENE_SAVER_WITH_PRIORITY

#define MR_ADD_SCENE_SAVER_WITH_PRIORITY ( filter,
saver,
priority )   MR_ON_INIT { using namespace MR::SceneSave; setSceneSaver( filter, saver, priority ); };

◆ MR_FORMAT_REGISTRY_DECL

#define MR_FORMAT_REGISTRY_DECL ( ProcName)    MR_FORMAT_REGISTRY_EXTERNAL_DECL( MRMESH_API, ProcName )

◆ MR_FORMAT_REGISTRY_EXTERNAL_DECL

#define MR_FORMAT_REGISTRY_EXTERNAL_DECL ( API_ATTR,
ProcName )
Value:
API_ATTR ProcName MR_CONCAT( get, ProcName )( const IOFilter& filter ); \
API_ATTR ProcName MR_CONCAT( get, ProcName )( const std::string& extension ); \
API_ATTR void MR_CONCAT( set, ProcName )( const IOFilter& filter, ProcName proc, int8_t priorityScore = 0 ); \
API_ATTR const IOFilters& getFilters();
#define MR_CONCAT(a, b)
Definition MRMacros.h:17

◆ MR_FORMAT_REGISTRY_IMPL

#define MR_FORMAT_REGISTRY_IMPL ( ProcName)
Value:
ProcName MR_CONCAT( get, ProcName )( const IOFilter& filter ) \
{ \
return FormatRegistry<ProcName>::getProcessor( filter ); \
} \
ProcName MR_CONCAT( get, ProcName )( const std::string& extension ) \
{ \
return FormatRegistry<ProcName>::getProcessor( extension ); \
} \
void MR_CONCAT( set, ProcName )( const IOFilter& filter, ProcName processor, int8_t priorityScore ) \
{ \
FormatRegistry<ProcName>::setProcessor( filter, processor, priorityScore ); \
} \
const IOFilters& getFilters() \
{ \
return FormatRegistry<ProcName>::getFilters(); \
}
std::vector< IOFilter > IOFilters
Definition MRIOFilters.h:32